I have a list.
movie=[the Slow and Confused 9, Somebody, Gorilla vs. King, The Blundering 3: Boss Made Me Do It]
I am trying to toggle between list items using input.
If I key in "N", 1 will be added to i and the respective index will be printed.
My code is:
i = 0
while True:
print("Product", 1 + i, "of", len(movie))
print("====================")
print("Name: ", movie[i])
print("====================")
print("Enter N for Next Item")
print("Enter P for Previous Item")
print("Enter M to return to Main Menu")
option1input = input("")
if option1input.upper == "N":
i+=1
elif option1input.upper == "P":
i-=1
elif option1input.upper == "M":
break
else:
pass
However, when I key in N, 1 is not added i
Aucun commentaire:
Enregistrer un commentaire