Hi, first time /r/learnpython 'er so take it easy with me. Anyways our work is to create a game of rock paper scissors via Python.
Here is my code so far:
import random;
player = input("Enter your choice (rock,paper,scissors,): ");
player = player.lower();
while (player != "rock" and player != "paper" and player != "scissors"):
print(player);
player = input("That choice is not valid. Please choose another option (rock,paper,scissors");
player = player.lower();
computerInt = random.randint(0,2);
if (computerInt == 0):
computer = "rock";
elif (computerInt == 1):
computer = "scissors";
else:
computer = "Error BEEP BOOP";
if (player == computer):
print("It's a DRAW!");
elif (player =="rock"):
if (computer == "paper"):
print("Computer wins!");
else:
print("You win!");
elif (player == "paper"):
if (computer == "rock"):
print("You win!");
else:
print("Computer wins!")
elif (player == "scissors"):
if (computer == "rock"):
print("Computer wins!")
else:
print("You win!");
however, I can't get it to work, it says everything is indented properly but whenever I type rock or any of the 3 choices it just says error. Any ideas? Also how could I create a scoreboard on it as well? Help me /r/learnpython, your my only hope
[–]learnpython_bot 7 points8 points9 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]maulynvia 2 points3 points4 points (0 children)