import time #Intro asking for player name print('Hello there player. Welcome to the maths quiz!') print('First, what is your name?') print('') pname= input() print('') print("Well, hello" , pname) #A small timestop time.sleep(1) print('Just a reminder, but if you will take more than 5 guesses, I will move on') print('Well, having that in mind, let us start the quiz then shall we then?') print #First math question print('QUESTION ONE') counter = 0 score = 0 #A loop with different answers to the integer that is given while counter<5: print('What is 4 + 4?') answer1 = int(input()) counter += 1 if answer1 < 0: print('Error') elif answer1 == 0: print('Are you kidding?') elif answer1 == 1: print('Not even close') elif answer1 == 2: print('Thats a quarter of it, I guess...') elif answer1 < 8: print("It's more than that") elif answer1 > 8: print('Too far off, friend') elif answer1 == 8: print('Wow! Well done!') if counter == 1: score += 1 break print('Let us be on to question 2 now, no?') print time.sleep(1) print('QUESTION TWO') counter = 0 while counter<5: print('What is 6 + 4?') answer2 = int(input()) counter += 1 if answer2 < 0: print('Error') elif answer2 == 0: print('Are you kidding?') elif answer2 == 1: print('Not even close') elif answer2 == 2: print('Nope...') elif answer2 < 10: print("It's more than that") elif answer2 > 10: print('Too far off, friend') elif answer2 == 10: print('Wow! Well done!') if counter == 1: score += 1 break print('Question 3!!') print time.sleep(1) print('QUESTION THREE') counter = 0 while counter<5: print('What is 5 + 2?') answer3 = int(input()) counter += 1 if answer3 < 0: print('Error') elif answer3 == 0: print('Are you kidding?') elif answer3 == 1: print('Not even close') elif answer3 == 2: print('Nope...') elif answer3 < 7: print("It's more than that") elif answer3 > 7: print('Too far off, friend') elif answer3 == 7: print('Wow! Well done!') if counter == 1: score += 1 break print("Almost done, we're on question 4!") print time.sleep(1) print('QUESTION FOUR') counter = 0 while counter<5: print('What is 5 + 6?') answer4 = int(input()) counter += 1 if answer4 < 0: print('Error') elif answer4 == 0: print('Are you kidding?') elif answer4 == 1: print('Not even close') elif answer4 == 2: print('Nope...') elif answer4 < 11: print("It's more than that") elif answer4 > 11: print('Too far off, friend') elif answer4 == 11: print('Wow! Well done!') if counter == 1: score += 1 break print("Lasssst question!") print ("") time.sleep(1) print('QUESTION FIVE') counter = 0 while counter<5: print('What is 2 + 3?') answer5 = int(input()) counter += 1 if answer5 < 0: print('Error') elif answer5 == 0: print('Are you kidding?') elif answer5 == 1: print('Not even close') elif answer5 == 2: print('Nope...') elif answer5 < 5: print("It's more than that") elif answer5 > 5: print('Too far off, friend') elif answer5 == 5: print('Woo hoo! Well done!') if counter == 1: score += 1 break print("Well", pname, "i'm happy to announce your final score was...:", score, "!")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question