[Tutor] if statement

Glen Clark glenuk at gmail.com
Tue Nov 2 20:07:18 CET 2010


sorry:

NumItems = int(input("How many Items: "))


Entries = []
for In in range(0,NumItems):
   Entries.append("")
   	


for In in range(0,NumItems):
   Entries[In]=str(input("Enter name " + str(In+1) + ": "))
   

for In in range(0,NumItems):
   print(Entries[In])

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

if confirmed == "y":
   for In in range(0,NumItems):
      print(Entries[In] + ": " + str(In))
   change = int(input("Which item would you like to change: ")   
   Entries[change]=str(input("Please enter a nem name: ")
else:
    #do nothing
    
print(Entries)

On Tue, 2010-11-02 at 15:05 -0400, Alex Hall wrote:
> On 11/2/10, Glen Clark <glenuk at gmail.com> wrote:
> >  File "/home/glen/workspace/test.py", line 19
> >     if confirmed == "y":
> >                        ^
> > SyntaxError: invalid syntax
> >
> > Why does this not work??? PyDev says "Expected:else"
> It may help to see the rest of the file, or at least more of the code
> surrounding this statement.
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >
> 
> 




More information about the Tutor mailing list