The problem with this code is no matter what is the outcome of the random choice function, it will print out the if statement.
I could make an IF statement for each cake individually and that could fix the problem but let's code smart here. I am sure there is a way to fix this, any idea?
Thank you already.
import random
input("welcome to the 'my favorite cake.' \nI will ask you some questions and guess your favorite cake.\nPress any key to continue...")
input("What Is Your Name?")
input("Where Are You From?")
input("How Old Are You?")
crush = input("What Is the First Name Of Your Crush?")
def local():
expression = ["WOW", "NFW", "OMG", "WTH", "Jezz", "Gross", "Ewwww","ooooooooo" , "Yum!"]
print(random.choice(expression))
local()
mylist = ["'Beer Cake'", "'Banana Cake'", "'Red velvet Cake'", "'Lemon Cake'", "'Dark chocolate Cake'",
"'Sardine Cake'", "'Caterpillar Cake'", "'Slug Cake'", "'Cockroach Cake'", "'Garlic Cake'",]
out = random.choice(mylist)
print("Your favourite cake is ", out)
if out == "'Sardine Cake'" or "'Caterpillar Cake'" or "'Slug Cake'" or "'Cockroach Cake'" or"'Garlic Cake'":
print("Maybe this is why", crush, "will not date you!?")
celeb = ["'Kim Kardashian'", "'Kim Jong Un'", "'Donald Trump'", "'Adolf Hitler'",
"'Margaret Thatcher'", "'Ross Geller'", "'Andy Bernard'", "'Squidward'", "'Rick Sanchez'", ]
print("Fun fact: that is the favorite cake of,", random.choice(celeb), "too.")
Aucun commentaire:
Enregistrer un commentaire