HI i'm writing a quiz for school and i don't know how to add a restart to the program or a score. Here is my code.
-with the restart i just want a yes,no thing
# rhys translation quiz
#intro and intrustions
print ("Welcome to the translation quiz \nYou will be ask a series of questions and have 2 tries per questions\nIf you get the correct answer you will get one point, if you get it wrong you will get zero points\nGOOD LUCK!!!\n")
#asking for age to know how many questions to ask
print("How old are you?")
age = int(input())
if age <= 5:
print("You will be asked five questions\n")
elif age > 6:
print("You will be asked ten questions\n")
else:
print("Try again\n")
#the word that will have to be translated
question1 = "What is Kia ora in english"
#the opinions that the user and pick from
options1 = "a. Hello\nb. Bye\nc. Greetings\nd. See ya\n"
print(question1)
print(options1)
#user will have to enter a,b,c or d for there answer
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
#simple, if answer is correct print correct and move on to next question, if not try again
if response == "a" or "A":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "a" or "A":
print ("Correct\n")
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
#repeat
question2 = "What is tēnā rawa atu koe in english"
options2 = "a. Give it\nb. bye\nc. Thank you\nd. See ya\n"
print(question2)
print(options2)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "c" or "C":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "c" or "C":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question3 = "What is rorohiko in english"
options3 = "a. TV\nb. Microwave\nc. Oven\nd. Computer\n"
print(question3)
print(options3)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "d" or "D":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "d" or "D":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question4 = "What is motukā in english"
options4 = "a. Van\nb. Car\nc. Truck\nd. bus\n"
print(question4)
print(options4)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "c" or "C":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "c" or "C":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question5 = "What is whare kotahi in english"
options5 = "a. Deck\nb. Game\nc. Suit\nd. Card\n"
print(question5)
print(options5)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "d" or "D":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "d" or "D":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question6 = "What is haupa in english"
options6 = "a. Food\nb. Drink\nc. Soup\nd. Water\n"
print(question6)
print(options6)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "a" or "A":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "a" or "A":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question7 = "What is Ngā Aho Whakaari in english"
options7 = "a. Show\nb. Film\nc. Song\nd. Book\n"
print(question7)
print(options7)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "b" or "B":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "b" or "B":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question8 = "What is makawe in english"
options8 = "a. Face\nb. Hair\nc. Neck\nd. Beard\n"
print(question8)
print(options8)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "b" or "B":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "b" or "B":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question9 = "What is tau in english"
options9 = "a. Letter\nb. Number\nc. Space\nd. Shape\n"
print(question9)
print(options9)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "b" or "B":
print ("Correct\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "b" or "B":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break
question10 = "What is wini in english"
options10 = "a. Win\nb. Lose\nc. Try again\nd. Quit\n"
print(question10)
print(options10)
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "a" or "A":
print ("CONGRATULATIONS YOU WIN\n")
break
else:
print("Wrong. Try again.\n")
while True:
response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")
if response == "a" or "A":
stop = True
break
else:
print("Wrong. You ran out of attempts\n")
stop = True
break
if stop:
break