Вы находитесь на странице: 1из 2

import easygui

score = 0

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

#T/F 1
answer1 = easygui.ynbox("The national animal of Scotland is the unicorn. True or
False?")
title = "TrueFalse1"
if answer1 == True:
score = score + 1

#T/F2
answer2 = easygui.ynbox("Abraham Lincoln and Albert Einstein were alive at the same
time. Their lives overlapped by 14 years. True or False?")
title = "TrueFalse2"
if answer2 == False:
score = score + 1

#T/F3
answer3 = easygui.ynbox("There are crystals in your head, and if you knock them loose,
you can become dizzy or ill. True or False?")
title = "TrueFalse3"
if answer3 == True:
score = score + 1

#Short answer1
answer4 = easygui.enterbox("What is GUI stands for?")
if answer4 == "graphical user interface":
score = score + 1

#Short answer2
answer5 = easygui.enterbox("What is the capital city of Denmark?")
if answer5 == "Copenhagen":
score = score + 1

#Short answer3
answer6 = easygui.enterbox("What is SER stands for?")
if answer6 == "Smooth endoplasmic reticulum":
score = score + 1

#MCQ1
msg = "What is the largest country in the world?"
title = "General knowledge"
choices = ["China","Russia", "Canada", "USA"]
choice = easygui.choicebox(msg, title, choices)

if choice == "Russia":
score = score + 1
easygui.msgbox(choice)

#MCQ2
msg = "How many legs does a spider have?"
title = "General knowledge"
choices = ["4","6", "8", "9"]
choice = easygui.choicebox(msg, title, choices)

if choice == "8":
score = score + 1
easygui.msgbox(choice)
#MCQ3
msg = "Who is the current president of Sweden?"
title = "General knowledge"
choices = ["Stefan Lfven","Gran Persson", "Ingvar Carlsson", "Olof Palme"]
choice = easygui.choicebox(msg, title, choices)

if choice == "Stefan Lfven":


score = score + 1
easygui.msgbox(choice)

#MCQ4
msg = "Which one is the deepest trench in the world?"
title = "General knowledge"
choices = ["Tonga Trench","Puerto Rico Trench", "Oceanic Trench", "Mariana Trench"]
choice = easygui.choicebox(msg, title, choices)

if choice == "Mariana Trench":


score = score + 1
easygui.msgbox(choice)

percentage = str(int(score/10 * 100)) + "%"

if score >=9:
g = "A"
elif score >=8.5 and score < 9:
g = "B+"
elif score >=8 and score < 8.5:
g = "B"
elif score >=7.5 and score < 8.5:
g = "C+"
elif score >=7 and score < 7.5:
g = "C"
elif score >=6.5 and score < 7:
g = "D+"
elif score >=6 and score < 6.5:
g = "D"
else:
g = "F"

easygui.msgbox("You got" + percentage + " = " + str(g))

Вам также может понравиться