You are on page 1of 2

import easygui

name = easygui.enterbox("Enter your name:")


score = 0
# yes or no question
answer = easygui.ynbox("Do you in relationship?")
if answer == True:
score = score + 1
answer = easygui.ynbox("Do you ever been to HongKong before?")
if answer == True:
score = score + 1
answer = easygui.ynbox("Do you like to watch movie?")
if answer == True:
score = score + 1
# short answer
msg = "How many female student in 1004?:"
title = "the 1004 squad"
answer = easygui.enterbox(msg, title)
if answer == "15":
score = score + 1
msg = "How many male student in 1004?:"
title = "the 1004 squad"
answer = easygui.enterbox(msg)
if answer == "9":
score = score + 1
msg = "How many room in grade 10?:"
title = "the 1004 squad"
answer = easygui.enterbox(msg, title)
if answer == "9":
score = score + 1
# MCQ
msg = "How many Quarer in this year?"
title = "- Let's try -"
choices = ("1", "2", "3", "4")
choice = easygui.choicebox(msg, title, choices)
if choice == "4":
score = score + 1
msg = "How old are you?"
title = "- Let's try -"
choices = ("11", "15", "16", "17")
choice = easygui.choicebox(msg, title, choices)
if choice == "15":
score = score + 1
elif choice == "16":
score = score + 1
msg = "Who is Donald Trump?"
title = "- Let's try -"
choices = ("A famous dog", "President of USA", "Chef", "My father")
choice = easygui.choicebox(msg, title, choices)
if choice == "President of USA":
score = score + 1
msg = "Which is the biggest country in the world?"
title = "- Let's try -"
choices = ("Russia", "Canada", "China", "USA")
choice = easygui.choicebox(msg, title, choices)
if choice == "Russia":
score = score + 1
percentage = (int(score / 10 * 100))
# score
if 90 <= percentage <= 100:
easygui.msgbox("A" + str(percentage) + "%")
elif 85 <= percentage < 90:
easygui.msgbox("B+" + str(percentage) + "%")
elif 80 <= percentage < 85:
easygui.msgbox("B" + str(percentage) + "%")
elif 75 <= percentage < 80:
easygui.msgbox("C+" + str(percentage) + "%")
elif 70 <= percentage < 75:
easygui.msgbox("C" + str(percentage) + "%")
elif 65 <= percentage < 70:
easygui.msgbox("D+" + str(percentage) + "%")
elif 60 <= percentage < 65:
easygui.msgbox("D" + str(percentage) + "%")
else:
easygui.msgbox("F" + str(percentage) + "%")

You might also like