# Python Math Quiz Project From Easy To Hardest Mode ## Keywords for python math quiz project

• python random maths quiz
• quiz in python
• how to make a multiple choice quiz in python
• python quiz code with the score
• python math example
• how to generate random maths questions in python
• python mathematical programming
• python chapter 5 math quiz

## Code

`import random#inut user for levels and number of question per levellevels = int(input("Enter number of levels you want to play : "))questions = int(input("ENter number of questions per level  : "))#i to checks leveli = 1#As single digit is between 1 and 9 so start = 1 and end  = 9start = 1end = 9#to save scorescore = 0#looping until levelswhile i <= levels:    print("level ",i)    j = 1    #looping until questions in each level    for q in range(questions):        #generating two random numbers and random operator from + and -        num1 = random.randint(start,end)        num2 = random.randint(start,end)        operator = random.choice(['+','-'])        #making question as string        questionStatement = str(num1) + operator + str(num2)        #using eval function getting result        result = int(eval(questionStatement))        #showing statement to user and getting user answer        useranswer = int(input(f"Q#{j} {questionStatement} ? "))        #if answer matches result then showing message and giving 1 point else showing right answer        if useranswer == result:            print("You answered correctly...")            score += 1        else:            print("Sorry , you'r answer is wrong,correct is ",result)        #incrementing to increase question by 1        j += 1        print()    #for next round let's say round 2 it have to be 2 digit and round 3 3 digit and so on    #so making 1 to 10 and 9 to 99 and then 10 to 100 and 99 to 999 and so on    start = start * 10    end = (end * 10) + 9    i += 1#finally printing scoreprint("\n\n")print("Your score is : ",score)#Any question or suggestion?#i will like to answers your query in comments#Thanks and have a healthy life :)`

## DEMO 