diff --git a/8-modules/39_slot_machine_2.py b/8-modules/39_slot_machine_2.py index 6b5cb8b..27339aa 100644 --- a/8-modules/39_slot_machine_2.py +++ b/8-modules/39_slot_machine_2.py @@ -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!') \ No newline at end of file