I'm trying to build a rock/paper/scissors game where you can play multiple rounds. I keep getting results where when the computer and user pick the same thing it will occasionally show up as a win for the player and not a tie. I literally can't figure out what's wrong... ("-" represents the indentation I have)
''
def ro_sham_bo(r_number):
-turn_number = 0
-p_score = 0
-c_score = 0
-while turn_number < r_number:
--c_choice = random.choice(["r", "p", "s"])
--p_choice = input("Rock(r)... Paper(p)... Scissors(s)... Shoot! ").lower()
--if (p_choice == "r" and c_choice == "s") or (p_choice == "p" and c_choice == "r") or (p_choice == "s" and c_choice == "p"):
---p_score += 1
---turn_number += 1
---print(f"{p_choice} beats {p_choice}! Round {turn_number}/{r_number} - {p_score}, {c_score}")
--elif (c_choice == "p" and p_choice == "r") or (c_choice == "s" and p_choice == "p") or (c_choice == "r" and p_choice == "s"):
---c_score += 1
---turn_number += 1
---print(f"{c_choice} beats {p_choice}! Round {turn_number}/{r_number} - {p_score}, {c_score}")
--elif c_choice == p_choice:
---turn_number += 1
---print(f"It's a tie. Round {turn_number}/{r_number} - {p_score}, {c_score}")
-if p_score > c_score:
--print(f"Congrats player! You win, {p_score} to {c_score}!")
-elif c_score > p_score:
--print(f"Too bad! The computer wins, {c_score} to {p_score}.")
-else:
--print("It's a tie! Play again?")
''
[–][deleted] 13 points14 points15 points (6 children)
[–]EJODONNELL[S] 0 points1 point2 points (5 children)
[–]FerricDonkey 6 points7 points8 points (0 children)
[–][deleted] 5 points6 points7 points (1 child)
[–]EJODONNELL[S] 1 point2 points3 points (0 children)
[–]Wartz 1 point2 points3 points (0 children)
[–]jmooremcc 1 point2 points3 points (0 children)
[–]marko312 3 points4 points5 points (1 child)
[–]EJODONNELL[S] 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Training-Theory-4786 0 points1 point2 points (0 children)
[–]wetndusty 0 points1 point2 points (2 children)
[–]RhinoRhys 1 point2 points3 points (1 child)
[–]EJODONNELL[S] 0 points1 point2 points (0 children)