Commit 8dc18f37 by BellCodeEditor

save project

parent 408d90fb
Showing with 12 additions and 9 deletions
import random import random
while True:
player=input("玩家出石头/剪刀/布") player=input("玩家出石头/剪刀/布")
print(player) print(player)
a=["剪刀","石头","布"] a=["剪刀","石头","布"]
b=random.choice(a) player2=random.choice(a)
print(b) print(player2)
if player==b: if player in a:
if player==player2:
print("平局") print("平局")
elif player=="剪刀" and b=="布": elif player=="剪刀" and player2=="布":
print("你赢") print("你赢")
elif player=="石头" and b=="剪刀": elif player=="石头" and player2=="剪刀":
print("你赢了")
elif player=="布" and player2=="石头" :
print("你赢了") print("你赢了")
elif player=="布" and b=="石头" :
else: else:
print("你输了") print("你输了")
\ No newline at end of file else:
print("你输错了")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment