File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Python Slot Machine
2- # user has balance
3- # user can bet amount
2+ # As a user, I want to play a slot machine game where I can bet an amount from my balance
3+ # I want to be able to spin the machine, and either win or lose money based on the outcome.
4+ # The slot machine will have three symbols, and if all three match, I win a jackpot.
5+ # If two match, I win a smaller amount. If none match, I lose my bet.
6+ # The game continues until I choose to quit or run out of money.
7+ # Implement the slot machine game in Python.
48
59import random
610
Original file line number Diff line number Diff line change 1- # Encryption Program
1+ # substitution cipher encryption and decryption program
2+ # write the entire user story for this program
3+ # As a user, I want to be able to encrypt and decrypt messages using a substitution cipher
4+ # So that I can securely communicate with others without my messages being easily read by unintended recipients
5+
6+ import random , string
7+
8+ chars = "" + " " + string .punctuation + string .digits + string .ascii_letters
9+
10+ chars = list (chars )
11+
12+ key = chars .copy ()
13+
14+ random .shuffle (key )
15+
16+ print (f"chars: { chars } " )
17+ print (f"key: { key } " )
18+
19+ # ENCRYPTION
20+ plain_text = input ("Enter a message to encrypt" )
21+ cipher_text = ""
22+
23+ for letter in plain_text :
24+ index = chars .index (letter )
25+ cipher_text += key [index ]
26+
27+ print (f'original message: { plain_text } ' )
28+ print (f'encryption message: { cipher_text } ' )
You can’t perform that action at this time.
0 commit comments