Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 39_slot_machine_2.py #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions 8-modules/39_slot_machine_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
]

def play():
results = random.choices(symbols, k=3)
print(results[0] + ' | ' + results[1] + ' | ' + results[2])

if results[0] == '7️⃣' and results[1] == '7️⃣' and results[2] == '7️⃣':
print('Jackpot! 💰')
else:
print('Thank for playing!')

question = input("Do you want to start the game? If yes: Click 'Y' If no: Click 'N'")
while question == 'Y':
play()
question = input("Do you want to continue? If yes: Click 'Y' If no: Click 'N'")

for i in range(1, 51):
results = random.choices(symbols, k=3)
print(f'{results[0]} | {results[1]} | {results[2]}')
win = results[0] == '7️⃣' and results[1] == '7️⃣' and results[2] == '7️⃣'

if win:
print('Jackpot!!! 💰')
break
else:
results = random.choices(symbols, k=3)

answer = ''
while answer.upper() != 'N':
play()
answer = input('Keep playing? (Y/N) ')

print('Thanks for playing!')