> print 'testvar: %.2f' % testvar > Output: > testvar: 10.0123 Should be: print 'testvar: %.4f' % testvar Output: testvar: 10.0123
-- bhaaluu at gmail dot com On 9/24/07, bhaaluu <[EMAIL PROTECTED]> wrote: > Greetings, > > I ran the code sample you sent and found a couple of errors > that wouldn't let the code run. > > The first error has to do with variable assignment. > When you assign a variable, it is usually on the left and > what you want to assign to it is on the right. See Lines 25,29. > > The second error has to do with the first error in a way. > See Line 41. '%d' is a placeholder for an integer. '%2d' ? > '%s' is a placeholder for a string. > What "type" is the variable 'team'? > (Hint: print type(team)) > > '%.2f' is a placeholder for a float displaying > two places to the right of decimal point. > Example: > testvar = 10.012345 > print 'testvar: %.2f' % testvar > Output: > testvar: 10.01 > print 'testvar: %.2f' % testvar > Output: > testvar: 10.0123 > > As far as the maths in your program? I can't say. > Perhaps if you get the program running, you can figure them out? > > Debugging tips: > A cheap debugger that can be used > as you create your program can > be as simple as the following: > > variable = value # assign a variable a value > print variable # display the value > print type(variable) # display the variable 'type' > raw_input() # breakpoint: (Pause. Press <Enter> to Continue...) > > -- > bhaaluu at gmail dot com > > On 9/24/07, Chris <[EMAIL PROTECTED]> wrote: > > It's not a homework problem it is a practice problem to figure out how to > > code, to be able to do the assignments... > > > > > > Chris wrote: > > > If I sent you the problem can you build it so I know what it is suppose to > > > look like? I've spend too much time it, and made it worse...all I know is > > > that it does not produce the wanted results and is missing a loop... > > > > > > The worse part is that I did not find anything that can help me among the > > > hundreds of websites I visited... > > > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007 > > 3:59 PM > > > > > > > > No virus found in this outgoing message. > > Checked by AVG Free Edition. > > Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007 > > 3:59 PM > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor