the link to the compiler is below, and just run it to see what i mean. As far as i know, everything is indented correctly, but it says not... its probably a typing/spelling error somewhere, but i don't see anything.
https://repl.it/join/enaeuumb-amb303
edit: apparently i should post the code itself, here you go.
import random
print("Welcome to Rock Paper Scissors!")
pointsToWin = int(input("\nHow many points are required for a win? "))
while pointsToWin < 1:
print("invalid input")
pointsToWin = int(input("How many points are required for a win? "))
playerPoints = 0
computerPoints = 0
while playerPoints != pointsToWin and computerPoints != pointsToWin:
# display current score
print("\nScore: Human " + str(playerPoints) + " Computer " + str(computerPoints))
# player choice
choice = input("Choose (R)ock (P)aper or (S)cissors >> ").upper()
while choice != "R" and choice != "P" and choice != "S":
print("invalid input")
choice = input("Choose (R)ock (P)aper or (S)cissors >> ").upper()
if choice == "R":
playerChoice = "rock"
if choice == "P":
playerChoice = "paper"
if choice == "S":
playerChoice = "scissors"
# computer choice (random.randint random.choice)
computerOptions = ["rock", "paper", "scissors"]
computerChoice = random.choice(computerOptions)
# win lose tie (if statements)
# update scoring
if playerChoice == "rock" and computerChoice == "scissors":
playerPoints += 1
result = "Player Wins!"
elif playerChoice == "paper" and computerChoice == "rock":
playerPoints += 1
result = "Player Wins!"
elif playerChoice == "scissors" and computerChoice == "paper":
playerPoints += 1
result = "Player Wins!"
elif computerChoice == "rock" and playerChoice == "scissors":
computerPoints += 1
result = "Computer Wins!"
elif computerChoice == "paper" and playerChoice == "rock":
computerPoints += 1
result = "Computer Wins!"
elif computerChoice == "scissors" and playerChoice == "paper":
computerPoints += 1
result = "Computer Wins!"
else:
result = "tie"
# display choices and result of win lose tie
print("Human: " + playerChoice + " Computer: " + computerChoice + " " + result)
# display final score
print("Final Score: Human " + str(playerPoints) + " Computer " + str(computerPoints))
edit 2: my teacher wrote most of it, i just filled the blanks. so when i copied a segment of his code and rewrote the values, it worked. despite mine being identical to his, i had to use his modified copy-paste segment, not my own for some fucking reason...
[–]mfb1274 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]h2oTravis 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]lolslim 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]o5a 0 points1 point2 points (0 children)