Skip to content

Commit 074a1e1

Browse files
updated
1 parent d7d1e0c commit 074a1e1

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

43-slot-machine/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
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

59
import random
610

44-encryption-program/main.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
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}')

0 commit comments

Comments
 (0)