You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
Forfor n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.lower() == answer.lower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)
You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
For n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.lower() == answer.lower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)
You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
for n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.lower() == answer.lower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)
You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
For n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.tolowerlower() == answer.tolowerlower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)
You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
For n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.tolower() == answer.tolower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)
You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
For n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.lower() == answer.lower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)
You should generally avoid redundancy when programming.
I'd make a list and loop through it
QUESTIONS = [("A vehicle with the national registration code ‘PK’ would originate from which country?", "Pakistan"),
("In which English county is Blenheim Palace?", "Oxfordshire")] # Add more to this list
For n,(question, answer) in enumerate(QUESTIONS, 1):
time.sleep(2)
print("Question", n)
time.sleep(2)
user_answer = input(question)
if user_answer.tolower() == answer.tolower():
print("Correct answer")
score += 1
else:
print("Incorrect answer, the correct answer is", answer)
And so on
Hope this helps :-)