Last active
April 26, 2023 15:33
-
-
Save user21944/dc28ecbb283d836415b26bd618765272 to your computer and use it in GitHub Desktop.
Better than elincyt
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
#!/usr/bin/env python | |
import random | |
C = ["rock", "paper", "scissors"] | |
c = random.randint(0,2) | |
while True: | |
x = input("1: rock, 2: paper, 3: scissors\n") | |
if x.isdigit(): | |
x = int(x) - 1 | |
if (x >= 0 and x <= 2): break | |
print("Please select a valid option:") | |
print("You picked " + C[x] + ", computer picked " + C[c] + ".") | |
if ((x + 1) % len(C) == c): print("Computer wins.") | |
elif ((x - 1) % len(C) == c): print("You win.") | |
elif (x == c): print("Tie.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment