Input check taking multiple inputs to work
In lines 5-13, I detail what should happen when different inputs are chosen. But when trying to input the selections, it takes multiple of the same input to get a response. Is there a reason for this? If so, why, and how can I fix it?
Hi there. To solve this problem, you need to assign a variable to your input on line 4, like this:
animal = input()
Then in your IF statements, use the variable in the logic:
if animal == 'dog':
Give it a try and let me know if it works.
Your code is just invalid!
Change your code to like this:-
print('Choose your pet!') print('Dog, cat, or mouse?') print('▼・ᴥ・▼ ˓˓ก₍⸍⸌̣ʷ̣̫⸍̣⸌₎ค˒˒ ᘛ⁐̤ᕐᐷ ') inp = input('') if inp == 'dog': print('▼・ᴥ・▼') print('bark!') elif inp == 'cat': print('meow!') print(' ˓˓ก₍⸍⸌̣ʷ̣̫⸍̣⸌₎ค') elif inp =='mouse': print('squeak!') print('ᘛ⁐̤ᕐᐷ')
Reason:- You should have made the
input() into a variable like given above because giving
input() directly into
if statement will make a problem as
input() is a function and not a variable to declare in
Hope this helps