May-04-2021, 11:38 AM
(This post was last modified: May-04-2021, 11:48 AM by Yoriz.
Edit Reason: Added code tags
)
Hi all,
Im currently trying to learn python in my spare time, im trying to create a quiz but i am having some trouble getting my las question to work correctly.
for a10_1 i can answer with any input and it will print as a correct answer, and for the 2nd and 3rd inputs it goes straight to printing "You cannot enter duplicate answers"
bonus question: how can i make the script re ask the question if the user does input a duplicate?
Thank you in advance and sorry if my explanation of the problem is poor, new to this :)
Im currently trying to learn python in my spare time, im trying to create a quiz but i am having some trouble getting my las question to work correctly.
for a10_1 i can answer with any input and it will print as a correct answer, and for the 2nd and 3rd inputs it goes straight to printing "You cannot enter duplicate answers"
bonus question: how can i make the script re ask the question if the user does input a duplicate?
Thank you in advance and sorry if my explanation of the problem is poor, new to this :)
score = 0 print("Question 10") print("Name the only 3 principalities (1 point per correct answer)") a10_1 = input("What is your first answer?") if a10_1.lower() == "andorra" or "liechtenstein" or "monaco": print("Correct, 1 point added!") score += 1 else: print("Incorrect") a10_2 = input("What is your second answer?") if a10_2 == a10_1: print("You cannot enter duplicate answers") elif a10_2.lower() == "andorra" or "liechtenstein" or "monaco": print("Correct, 1 point added!") score += 1 else: print("Incorrect") a10_3 = input("What is your third answer?") if a10_3 == a10_1 or a10_2: print("You cannot enter duplicate answers") elif a10_3.lower() == "andorra" or "liechtenstein" or "monaco": print("Correct, 1 point added!") score += 1 else: print("Incorrect") print(score)