Vous êtes sur la page 1sur 3

import easygui

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


score = 0

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


title = "Health survey"
choices = ["0-30 minutes", "30 mins-1hr ", "1-2hrs", "more than 2 hrs"]
choice = easygui.choicebox(msg, title, choices)

if choice =="0-30 minutes":


score = score + 0
elif choice =="30 mins-1hr":
score = score + 1
elif choice =="1-2hrs":
score = score + 2
elif choice =="more than 2 hrs":
score = score + 3

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


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

if choice =="0-1 time":


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

msg ="What is your favorite food?"


title = "Health survey"
choices = ["pizza", "salad ", "KFC", "vegetable soup"]
choice = easygui.choicebox(msg, title, choices)

if choice =="pizza":
score = score + 0
elif choice =="KFC":
score = score + 0
elif choice =="salad":
score = score + 5
elif choice =="vegetable soup":
score = score + 5

msg ="What is your favorite sport?"


title = "Health survey"
choices = ["Run", "volleyball ", "Nothing", "Basketball"]
choice = easygui.choicebox(msg, title, choices)

if choice =="run":
score = score + 1
elif choice =="volleyball":
score = score + 5
elif choice =="basketball":
score = score + 5
elif choice =="nothing":
score = score + 0

msg ="Do you smoke?"


title = "Health survey"
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?"


title = "Health survey"
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 drug?"


title = "Health survey"
choices = ["yes", "no"]
choice = easygui.choicebox(msg, title, choices)

if choice =="yes":
score = score + 0
elif choice =="no":
score = score + 5

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("The nervous system is made up of these three parts?")


easygui.msgbox("brain, spinal cord, nerve")

if answer =="brain, spinal cord, nerve":


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

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

if answer =="talk with your parent":


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)

Vous aimerez peut-être aussi