[Tutor] if statement

christopher.henk at allisontransmission.com christopher.henk at allisontransmission.com
Tue Nov 2 20:36:27 CET 2010


Glen Clark wrote on 11/02/2010 03:07:18 PM:

in general you should use raw_input instead of input.

<SNIP>
> confirmed = int(input("Are you happy with this? (y/n): ")
> 

you are missing a closing parenthesis above, and converting a string (y,n) 
to and int
> if confirmed == "y":

you are comparing an int and a string here, probably not what you want 
(see above).

>    for In in range(0,NumItems):
>       print(Entries[In] + ": " + str(In))
>    change = int(input("Which item would you like to change: ") 

again, you are missing a closing parenthesis above

>    Entries[change]=str(input("Please enter a nem name: ")

again, you are missing a closing parenthesis above

> else:
>     #do nothing

you need to put pass here, you can't just have a comment in a block
> 
> print(Entries)
> 


Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101102/87ca32f2/attachment.html>


More information about the Tutor mailing list