Python Forum

Full Version: Pregnancy caculator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I make it so whenever I input "condom pullout birthcontrol spermicide" to work



print("pregnant percentage").upper()
print("-")*30
print("spermicide = 70.5")
print("condom = 82.0")
print("pullout = 83.0")
print("birthcontrol = 99.9")
print("none = 10.0")

#variables of birth control
spermicide = 70.5
condom = 82.0
pullout = 83.0
birthcontrol = 99.9
#what we don't want
none = 10.0
#or 80.0 percent chance of getting pregnant

chance = raw_input("Find how protected you are: ")
print("-")*30
if chance == "spermicide":
    print"Pervention percentage of using spermicide:",spermicide
elif chance == "condom":
    print"Pervention percentage of using a condom:",condom
elif chance == "pull out":
    print"Pervention percentage of pulling out:",pullout
elif chance == "birth control":
    print"Pervention percentage of using birth control:",birthcontrol
elif chance == "none":
    print"Pervention percentage of using no method of birth control:",none
#now we go to the actual magic of this program

elif chance == ("spermicide") or ("condom"):
    print"Pervention percentage of spermicide and the use of a condom:", spermicide + condom

elif chance == ("spermicide") or ("condom") or ("pullout"):
    print"Pervention percentage of spermicide and the use of a condom and pulling out:",spermicide + condom + pullout

elif chance == ("spermicide") or ("condom") or ("pullout") or ("birthcontrol"):
    print"Pervention percentage of spermicide and the use of a condom and pulling out and birth control:",spermicide + condom + pullout + birthcontrol

#next one
elif chance == "condom" or "pullout":
    print"Prevention percentage of using a condom and pulling out",condom + pullout
You may edit your post to contain proper contents/questions. Otherwise it will be deleted.