I am wanting to join the Royal Air Force and thought as a good way to prepare I should code myself a quiz about their aircraft.
There are 28 aircraft that I have added to the quiz.
For example - 'Where is the Typhoon FGR4 based?' And then I have 7 seconds to think before the options pop up for me to answer.
Instead of the quiz just going from the first to last question in the same order each time I would like it to be shuffled.
Here is the quiz in pastebin http://pastebin.com/wxVus42W
Also when I have answered the question I would like the console to clear itself for the next question to come up.
Can anyone help?
Thanks
dont repeat yourself!, create methods, add your question and the excepted answer as flag
import timedef create_question(question = "", answer = "", excepted = ""):print (question)time.sleep(7)print(answer)while True:response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")if response == excepted:#CHANGEprint ("Correct!\n")breakelse:print("Incorrect!!! Try again.")while True:response = input("Hit 'a', 'b', 'c' or 'd' for your answer\n")if response == excepted:#CHANGEprint ("Correct!\n")#CHANGEstop = Truebreakelse:print("Incorrect!!! The Tornado GR4 is based at RAF Marham\n")#CHANGEstop = Truebreakif stop:break#first question
create_question(question = "Where is the Tornado GR4 based?",answer = "a. RAF Marham\nb. RAF Conningsby\nc. RAF Waddington\nd. RAF Church Fenton\n",excepted = "a")
#second question
create_question(question = "Where is the Typhoon FGR4 Based?",answer = "a. RAF Marham\nb. RAF Conningsby\nc. RAF Benson\nd. RAF Wyton\n",excepted = "b")