Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pregnancy caculator
#1
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
Reply
#2
You may edit your post to contain proper contents/questions. Otherwise it will be deleted.
Reply
#3
read https://python-forum.io/Thread-Multiple-...or-keyword
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020