Created
March 24, 2021 04:06
-
-
Save DieJustizINTEGER/d5669bf3647b7a642c0916292c5ae02e to your computer and use it in GitHub Desktop.
Rock, Paper, Scissors (first code :D) -> Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
game = ['Stein', 'Schere', 'Papier'] # [rock, scissors, paper] | |
result1 = random.choice(game) | |
result2 = random.choice(game) | |
print(result1 + ' | ' + result2) | |
if result1 == result2: | |
print('Unentschieden!') # draw | |
elif result1 == 'Stein': | |
if result2 == 'Schere': | |
print('Spieler 1 gewinnt!') # player 1 wins! | |
else: | |
print('Spieler 2 gewinnt!') # player 2 wins! | |
elif result1 == 'Schere': | |
if result2 == 'Stein': | |
print('Spieler 2 gewinnt!') | |
else: | |
print('Spieler 1 gewinnt!') | |
elif result1 == 'Papier': | |
if result2 == 'Stein': | |
print('Spieler 1 gewinnt!') | |
else: | |
print('Spieler 2 gewinnt!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment