Skip to main content
Code Review

Return to Answer

edited body
Source Link

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 :-)

deleted 4 characters in body
Source Link

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 :-)

Source Link

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 :-)

lang-py

AltStyle によって変換されたページ (->オリジナル) /