[Tutor] if statement
Vince Spicer
vince at vinces.ca
Tue Nov 2 20:36:47 CET 2010
On Tue, Nov 2, 2010 at 1:07 PM, Glen Clark <glenuk at gmail.com> wrote:
> 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
> > >
> >
> >
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
confirmed = int(input("Are you happy with this? (y/n): ")
You are missing a ) that the end of this line to close the int
--
Vince Spicer
--
Sent from Ubuntu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101102/28fd48f3/attachment-0001.html>
More information about the Tutor
mailing list