Skip to content

Instantly share code, notes, and snippets.

@DieJustizINTEGER
Created March 24, 2021 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DieJustizINTEGER/d5669bf3647b7a642c0916292c5ae02e to your computer and use it in GitHub Desktop.
Save DieJustizINTEGER/d5669bf3647b7a642c0916292c5ae02e to your computer and use it in GitHub Desktop.
Rock, Paper, Scissors (first code :D) -> Python
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