File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Slot Machine 🎰
2
+ # Codédex
3
+
4
+ import random
5
+
6
+ slot_machine_symbols = [
7
+ '🍒' ,
8
+ '🍇' ,
9
+ '🍉' ,
10
+ '7️⃣'
11
+ ]
12
+
13
+ def play_slots ():
14
+ results = random .choices (slot_machine_symbols , k = 3 )
15
+ all_sevens = results [0 ] == '7️⃣' and results [1 ] == '7️⃣' and results [2 ] == '7️⃣'
16
+
17
+ while not all_sevens :
18
+ print (f'{ results [0 ]} | { results [1 ]} | { results [2 ]} ' )
19
+ all_sevens = results [0 ] == '7️⃣' and results [1 ] == '7️⃣' and results [2 ] == '7️⃣'
20
+
21
+ if all_sevens :
22
+ print ("Jackpot!!! 💰" )
23
+ else :
24
+ results = random .choices (slot_machine_symbols , k = 3 )
25
+ answer = "Y"
26
+
27
+ while answer .upper () != "N" :
28
+ play_slots ()
29
+ answer = input ("Keep playing? (Y/N) " )
30
+
31
+ print ("Thanks for playing!" )
Original file line number Diff line number Diff line change
1
+ # Birthday Card 🎂
2
+ # Codédex
3
+
4
+ import random , datetime
5
+
6
+ bday_messages = [
7
+ 'Hope you have a very Happy Birthday! 🎈' ,
8
+ 'It\' s your special day – get out there and celebrate!' ,
9
+ 'You were born and the world got better – everybody wins! Happy Birthday!'
10
+ ]
11
+
12
+ today = datetime .date .today ()
13
+
14
+ my_birthday = datetime .date (2023 , 4 , 5 )
15
+
16
+ days_away = my_birthday - today
17
+
18
+ if my_birthday == today :
19
+ print (random .choice (bday_messages ))
20
+ else :
21
+ print (f'My birthday is { days_away } away!' )
You can’t perform that action at this time.
0 commit comments