Skip to content
Advertisement

I’m fairly new to python coding so I’m trying to challenge myself to do elif statements and I can’t find how to fix this problem [closed]

So here is my code and I can’t see what causes the error.

JavaScript

The error is

JavaScript

Does anyone have any idea how to fix this?

Advertisement

Answer

The int part in the int(input(“What is your favorite food?: “)) line tries to convert the input string “egg” into an integer, which it can´t. Remove it and the problem will go away.

Also, after the if == or elif ==, you need to write the food type as “egg”, “pork”, “apple”, otherwise python think you are referring to an variable and not a specific string.

Good luck!

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement