Hi I got some problem about writting convention in python. Some tutorial ask me 
to write this :

a = 1
s = 0
print 'Enter Numbers to add to the sum.'
print 'Enter 0 to quit.'
while a != 0:
    print 'Current Sum:', s
    a = int(raw_input('Number? '))
    s = s + a
print 'Total Sum =', s

And the response must be like this :

Enter Numbers to add to the sum.
Enter 0 to quit.
Current Sum: 0
Number? 200
Current Sum: 200
Number? -15.25
Current Sum: 184.75
Number? -151.85
Current Sum: 32.9
Number? 10.00
Current Sum: 42.9
Number? 0
Total Sum = 42.9

But when I write until this :

>>> a = 1
>>> s = 0
>>> print 'Enter Numbers to add the sum'

I press enter, and alas my python response me :
Enter Numbers to add the sum

It didn't want waiting me until I finish writing the rest.
I know there is some mistake about my writing convention, 
but what ??? Can you find it ??

But you know it's not finish,I ignore the error message and 
writng the rest, but until i write this:

>>> while a != 0:
....     print 'Current Sum:', s
....     a = int(raw_input('Number?'))
....     s = s+a
.... print 'Total Sum =', s

Oh, man... another error message :

  File "<stdin>", line 5
    print 'Total Sum =', s
        ^

Can you help me guys ??











       
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to