-
Notifications
You must be signed in to change notification settings - Fork 344
Expand file tree
/
Copy path29_fortune_cookie_1.py
More file actions
47 lines (38 loc) · 1.3 KB
/
29_fortune_cookie_1.py
File metadata and controls
47 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Fortune Cookie 🥠
# Codédex
import random
options = [
'Don’t pursue happiness – create it.',
'All things are difficult before they are easy.',
'The early bird gets the worm, but the second mouse gets the cheese.',
'If you eat something and nobody sees you eat it, it has no calories.',
'Someone in your life needs a letter from you.',
'Don’t just think. Act!',
'Your heart will skip a beat.',
'The fortune you search for is in another cookie.',
'Help! I’m being held prisoner in a Chinese bakery!'
]
def fortune():
random_fortune = random.randint(0, len(options) - 1)
print(options[random_fortune])
fortune()
fortune()
fortune()
# Upadted Version
import random
options = [
'Don’t pursue happiness – create it.',
'All things are difficult before they are easy.',
'The early bird gets the worm, but the second mouse gets the cheese.',
'If you eat something and nobody sees you eat it, it has no calories.',
'Someone in your life needs a letter from you.',
'Don’t just think. Act!',
'Your heart will skip a beat.',
'The fortune you search for is in another cookie.',
'Help! I’m being held prisoner in a Chinese bakery!'
]
def fortune():
print(random.choice(options)) #No need to gen Random int as python can choose by itself
fortune()
fortune()
fortune()