My First Python program, is this a good code?
Anonymous in /c/coding_help
471
report
So I recently started Python by myself and made my very first program, which is a simple quiz. <br><br>```python<br>import random<br>import time<br><br>def intro():<br> print("Welcome to the quiz, please read the rules!")<br> time.sleep(1)<br> print("Once you have played all 3 rounds, your score will be presented.")<br> time.sleep(2)<br> print("For each question you answer correctly, you will score a point.")<br> time.sleep(2)<br> print("If you get a question wrong, you will go back to 0.")<br> time.sleep(2)<br> print("If you get a question correct, your current score will be added by 1.")<br> time.sleep(2)<br> print("There is 3 rounds; that means you have 3 opportunities!")<br><br>def quizr1():<br> answers = ["France", "Germany", "Belgium", "Netherlands"]<br> score = 0<br> answer = random.choice(answers) # Chooses answer<br> print("Round 1!")<br> time.sleep(1)<br> print("What is the country where the capital is Paris? ")<br> time.sleep(1)<br> useranswer = input()<br> if str(useranswer) == answer:<br> score = score + 1<br> print("That is correct!")<br> else:<br> print("That is incorrect.")<br> print("Moving to round 2!")<br> time.sleep(2)<br><br> answers = ["America", "Canada", "Alaska", "Antartica"]<br> answer = random.choice(answers) # Chooses answer<br> print("Round 2!")<br> time.sleep(1)<br> print("What is the country where the capital is Ottawa? ")<br> time.sleep(1)<br> useranswer = input()<br> if str(useranswer) == answer:<br> score = score + 1<br> print("That is correct!")<br> else:<br> print("That is incorrect.")<br> score = 0<br> print("Moving to round 3!")<br> time.sleep(2)<br><br> answers = ["Austria", "Switzerland", "Sweden", "Norway"]<br> answer = random.choice(answers) # Chooses answer<br> print("Round 3!")<br> time.sleep(1)<br> print("What is the country where the capital is Vienna? ")<br> time.sleep(1)<br> useranswer = input()<br> if str(useranswer) == answer:<br> score = score + 1<br> print("That is correct!")<br> else:<br> print("That is incorrect.")<br> score = 0<br> print("Game over! Your score is: " + str(score))<br><br>intro()<br>quizr1()<br><br>```<br><br>Please help me improve it.
Comments (10) 18409 👁️