Vous êtes sur la page 1sur 2

import easygui

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


score = 0

msg ="What is your favorite activity?"


title = "Health Rate Quiz"
choices = ["Run ", " Basketball ", " Nothing ", " Volleyball"]
choice = easygui.choicebox(msg, title, choices)

if choice == "Run":
score = score + 1
elif choice == "Basketball":
score = score + 5
elif choice == "Nothing":
score = score + 0
elif choice == "Volleyball":
score = score + 5

msg ="What is your favorite food?"


choices = [" Pizza ", " Salad ", " KFC ", " Vegetable soup"]
choice = easygui.choicebox(msg, title, choices)

if choice == "Pizza":
score = score + 0
elif choice == "Slad":
score = score + 5
elif choice == "KFC":
score = score + 0
elif choice == "Vegetable soup":
score = score + 5

msg ="How much time you spend on exercise per day?"


choices = ["1. 0-30 min. ", "2. 30min - 1 hour ", "3. 1 - 2 hours", "4. more than 2
hours"]
choice = easygui.choicebox(msg, title, choices)

if choice == "0-30 min":


score = score + 0
elif choice == "30min - 1 hour":
score = score + 1
elif choice == "1 - 2 hours":
score = score + 2
elif choice == "more than 2 hours":
score = score + 3

msg ="How often do you exercise per week?"


choices = ["1. 0-1 time ", "2. 2-3 times ", "3. 4-5 times", "4. more than 6 times"]
choice = easygui.choicebox(msg, title, choices)

if choice == "0-1 time":


score = score + 0
elif choice == "2-3 times":
score = score + 1
elif choice == "4-5 times":
score = score + 2
elif choice == "more than 6 times":
score = score + 3

msg ="Do you smoke?"


choices = ["Yes", "No "]
choice = easygui.choicebox(msg, title, choices)

if choice == "Yes":
score = score + 0
elif choice == "No":
score = score + 5
msg ="Do you drink alcohol?"
choices = ["Yes", "No "]
choice = easygui.choicebox(msg, title, choices)

if choice == "Yes":
score = score + 0
elif choice == "No":
score = score + 5

msg ="Do you use drugs?"


choices = ["Yes", "No "]
choice = easygui.choicebox(msg, title, choices)

if choice == "Yes":
score = score + 0
elif choice == "No":
score = score + 5

easygui.msgbox(choice)

answer = easygui.enterbox("The nervous system is made up of these three parts:")


easygui.msgbox("Brain, spinal cord, and nerves")

if answer == "Brain, spinal cord, and nerves":


score = score + 5
else:
score = score + 0

answer = easygui.enterbox("How often should you go to the dentist?")


easygui.msgbox("6 months")

if answer == "6 months":


score = score + 5
else:
score = score + 0

answer = easygui.enterbox("If you get stress, what will you do between talk with
your parents or suicide?")
easygui.msgbox("talk with your parents")

if answer == "talk with your parents":


score = score + 5
else:
score = score + 0

percentage = score / 46 * 100


percentage = str(percentage) + "%"

easygui.msgbox(percentage)
if score >= 41.4:
easygui.msgbox("A grade " + percentage)
elif 41.4 > score >= 36.8:
easygui.msgbox("B grade " + percentage)
elif 36.8 > score >= 32.2 :
easygui.msgbox("C grade " + percentage)
elif 32.2 > score >= 27.6:
easygui.msgbox("D grade " + percentage)
elif score <= 23:
easygui.msgbox("F grade " + percentage)