[Tutor] if statement
Adam Bark
adam.jtm30 at gmail.com
Tue Nov 2 20:34:26 CET 2010
On 02/11/10 19:07, Glen Clark 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)
>
>
Ok that's easier, you're missing a closing bracket at the end of the
confirmed = int(input("Are you happy with this? (y/n): ")
line.
I think you might need at least a pass after else as well, although it
should be fine to leave it out altogether once you've added the ')'.
HTH,
Adam.
More information about the Tutor
mailing list