things = ["shorts", "pen", "pencil"]
userthings = input("what do you want to find?")
userthings = userthings.lower()
bagged = False
for i in things:
if i == userthings:
bagged = True
if bagged == True:
print ("I has thing")
else:
print ("I dont has thing")
morestuff = input("Do you want to add anything else?")
morestuff = morestuff.lower()
while (morestuff == "yes" or "y"):
stuff = input("What do you want to add?")
str(stuff)
things.append(stuff)
print ("I have the following things:", things)
morestuff = input("Do you want to add anything else?")
else:
print ("Lol bye")
My problem is the while statement code, when I input "no" into morestuff
, or anything other than "yes"
or "y"
it doesn't print "Lol bye"
but carries on with the stuff = input("What do you want to add?")
statement and goes in an infinite loop.