Izzy the Iguana Code Question Need help with my answer
Practice Problem: Your pet Iguana has run away, and you found it up in a tree! It will come down right away if you brought the right snacks, but if you don't have enough, you will have to wait. You need 10 total snack points to bring it down. Lettuce is worth 5, Carrot is worth 4, Mango is worth 9, and Cheeseburger is worth 0. ANSWER ATTEMPT: #FOOD PRICES Lettuce = 5 Carrot = 4 Mango = 9 Cheeseburger = 0 ############ foods = input() def foods_list_convert(x): a = list(x.split(" ")) return a foodList = foods_list_convert(foods) i = 0 while i < len(foodList): grub = 0 if foodList[i] == str(Lettuce): grub += Lettuce elif foodList[i] == str(Carrot): grub += Carrot elif foodList[i] == str(Mango): grub += Mango elif foodList[i] == str(Cheeseburger): grub += Cheeseburger i += 1 if grub > 10: print("Come on Down") else: print("Time to wait") ------------------- MY THOUGHTS: I think issue with the variable grub. Don't know how to take the info out of the while loop and use the new grub that's totaled up.