私はちょうど学期の最初のプログラミング割り当てを受けました。ロックペーパーを作って、1人のプレイヤーが3回優勝するまで続くはさみゲームです。私はそれを稼働させることができましたが、最初にループバックするのが難しいです。Python-Beginnerでループする方法
ps1 = 0
ps2 = 0
from random import radint
player1 = imput('R, P, S')
print (player1, " vs ", end='')
chosen = randint(1,3)
#print (chosen)
if chosen == 1:
player2 = 'R'
elif chosen == 2:
player2 = 'P'
else:
player2 = 'S'
print(player2)
if player1 == player2:
print("Draw")
elif player1 == 'R' and player2 == 'S'
ps1 = ps1 + 1
print("Point to Player 1")
elif player1 == 'R' and player2 == 'P'
ps2 = ps2 + 1
print("Point to Player 2")
elif player1 == 'P' and player2 == 'S'
ps2 = ps2 + 1
print("Point to Player 2")
elif player1 == 'P' and player2 == 'R'
ps1 = ps1 + 1
print("Point to Player 1")
elif player1 == 'S' and player2 == 'R'
ps2 = ps2 + 1
print("Point to Player 2")
elif player1 == 'S' and player2 == 'P'
ps1 = ps1 + 1
print("Point to Player 1")
if ps1 = 3
print("Player 1 wins!")
elif ps2 = 3
print("Player 2 wins!")
[こちらを試してください](https://www.google.com/search?q=python+loops) –