You are on page 1of 3

import easygui

easygui.enterbox("What is your name?")

score = 0
#1tf
msg = "Are you handsome/pretty?"
choices = ["Yes","No"]
q1 = easygui.buttonbox(msg, choices=choices)
if q1 == "Yes":
score = score + 1

#2tf
q2=easygui.ynbox("Do you love MUIDS?")
if q2 == True:
score = score + 1

#3tf
q3=easygui.ynbox("Do you love Mr.Tim?")
if q3 == True:
score = score + 1

#1sq
q4=easygui.enterbox("How many letters in 'Antidisestablishmentarianism'?")
if q4 == "28":
score = score + 1

#2sq
q5=easygui.enterbox("Who is the richest man in the world")
if q5 == "Bill Gates":
score = score + 1

#3sq
q6=easygui.enterbox("What year was Isaac Newton born?")
if q6 == "1642":
score = score + 1

#1mcq
msg = "!+2+3+4+5+6+7+8+9+10 = ?"
title ="+"
choices =("a) 45","b) 50","c) 55","d) 60")
q7 = easygui.choicebox(msg, title, choices)
if q7 == "c) 55":
score = score + 1

#2mcq
msg = "Who was the founder(s) of Apple?"
title ="Apple"
choices =("a) Mark Zuckerberg","b) Steve Jobs","c) Bill Gates","d) Sergey Brin and
Larry Page")
q8 = easygui.choicebox(msg, title, choices)
if q8 == "b) Steve Jobs":
score = score + 1

#3mcq
msg = "Who invented python?"
title ="Python"
choices =("a) Guido van Rossum","b) Ed sheeran","c) Sergey Brin and Larry Page","d)
Donald Trump")
q9 = easygui.choicebox(msg, title, choices)
if q9 == "a) Guido van Rossum":
score = score + 1

#4mcq
msg = "What is an algorithm?"
title ="Algorithm"
choices =("a) cooking recipe","b) set of instructions","c) your wife","d) Justin Bieber")
q10 = easygui.choicebox(msg, title, choices)
if q10 == "b) set of instructions":
score = score + 1

#calculate score
percent = (score/10)*100

def grade():
if score <= 5:
return "F"
if score == 6:
return "D"
if score == 7:
return "C"
if score == 8:
return "B"
if score >= 9:
return "A"

easygui.msgbox("Your score is"+str(score)+"\n""Your percentage is"+str(percent)


+"%"+"\n""Your grade is"+ grade())

You might also like