ציטוט: |
#Write a program that simulates a fortune cookie. The program
#should display one of five unique fortunes, at random, each #time it’s run. |
קוד: |
import random
# list of furtune cookie sayings one = "For hate is never conquered by hate. Hate is conquered by love ." two = "Your worst enemy has a crush on you!" three = "You will make many changes before settling down happily." four = "If you have something worth fighting for, then fight for it." five = "In music, one must think with his heart and feel with his brain." # choosing one randomly cookie = random.randint(1, 5) if cookie |
קוד: |
if cookie == 1: print(one) elif cookie == 2: print(two) .... |