Why is my output repeating the print functions associated to the variables? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is my output repeating the print functions associated to the variables?

I started learning Python few days ago so please spare my naivety I want the program to execute just one if or while command,but it's repeating the commands associated to the variables :lion="Grr" snake="Ssss" bird="Chirp" tiger="Rawr" noise=input("") while noise == lion and snake: print("Am scared!!!!!\n" *3); break while noise == lion and tiger: print("I need miracle!!!\n" *3); break while noise==bird and snake: print("I shall conquer"); break if noise ==snake and tiger: print("I dont kno what to do"); if noise ==lion: print("Lion " + lion); if noise ==snake: print("Snake " +snake); else: print("Am tirde")

28th Mar 2020, 11:15 AM
Gasp Media
1 Answer
+ 2
I do not get what you want to express with noise== lion and snake. If you mean noise == lion and noise == snake than you have to write this, but this does not make sense since a text can not be Grr and Ssss at the same time
29th Mar 2020, 1:07 PM
Alexander Thiem
Alexander Thiem - avatar