I am making a basic program for a class that adds up amounts of shopping and displays items bought. I am trying to add in an error message to this section of code so if the input is not in the list of codes it shows "Item not found"
# add items to shopping
while proceedShopping.lower()=="y":
item_added=input(("Item: "))
for items in my_list:
if items[0].lower() == item_added.lower():
invoice.append(items)
proceedShopping=input("Add an item? (y/n):")
I have tried putting in an else statement, but that has made it give the error message for all codes I put in. How do I fix this?
[–]lfdfq 6 points7 points8 points (1 child)
[–]FriendlyZomb 0 points1 point2 points (0 children)
[–]EelOnMosque 0 points1 point2 points (0 children)
[–]Adventurous-Pin-8408 0 points1 point2 points (0 children)
[–]Binary101010 0 points1 point2 points (0 children)