import random
actions=["rock", "paper", "scissors"]
#Set the scores of players to 0
pc_score=0
player_score=0
total_rounds=input("How many round do you want to play: ")
round_counter=0
#Write a while loop and put the game inside
while True:
round_counter =round_counter+1
print("ROUND ", round_counter)
pc_choice=random.choice(actions)
player_choice=input("Choose your action: ")
print("Computer:", pc_choice)
print("Player:", player_choice)
if pc_choice==player_choice:
print("Tie! Both player choose the same action.")
elif pc_choice=="paper:":
if player_choice=="rock":
print("Winner is: Computer")
pc_score +=1
else:
print("Winner is: Player")
player_score +=1
elif pc_choice=="rock:":
if player_choice=="scissors":
print("Winner is: Computer")
pc_score +=1
else:
print("Winner is: Player")
player_score +=1
elif pc_choice=="scissors:":
if player_choice=="paper":
print("Winner is: Computer")
pc_score +=1
else:
print("Winner is: Player")
player_score +=1
if round_counter==int(total_rounds):
break
if pc_score==player_score:
print("There is no winner, tie ", pc_score,":", player_score)
elif pc_score>player_score:
print("Computer is winner with score ", pc_score,":", player_score)
elif pc_score<player_score:
print("Player is winner with score ", pc_score,":", player_score)
Taş-Kağıt-Makas oyunu yaptım ancak kodda çalışırken hata vermemesine rağmen oyuncuların scorelarını saymıyor ve bu tüzden sürekli 0-0 berabere bırakıyor. Yardımcı olursanız çok sevinirim.