I Have already gone through a similar question but that didn't help I was given this assignment to create a program that shall ask a question say what is 2+2 and will detect if the input given by the user matches the pre-declared var say, ans = 4. If the answer was correct, the program will praise the user and stop else the program will say Try Again! and let the user input again.
I made slight change for having fun :p but the thing is the MAIN PART DOES NOT WORK AS IT SHOULD. And even if I eneter the right answer the code skips to the ELSE block which would only be considered if the ans was incorrect.
Please Help me out I need to submit this tomorrow :)
My code along with images :
#Python_Maketh_Perfect
answer = 5
question =input("What is the cube root of 125? ")
if question == answer:
print ("Good!")
else:
trial = input("Incorrect! Try again ")
while trial != answer:
print ("YOu NUUUB GET NO B(.)(.)B")
Aucun commentaire:
Enregistrer un commentaire