2024年4月13日发(作者:)
import random
def rock_paper_scissors():
choices = ["石头", "剪刀", "布"]
while True:
player_choice = input("请输入你的选择(石头/剪刀/布):")
player_choice = player_()
if player_choice not in choices:
print("输入无效,请重新输入。")
continue
computer_choice = (choices)
print(f"你选择了:{player_choice}")
print(f"计算机选择了:{computer_choice}")
if player_choice == computer_choice:
print("平局!")
elif (player_choice == "石头" and computer_choice == "剪刀") or
(player_choice == "剪刀" and computer_choice == "布") or
(player_choice == "布" and computer_choice == "石头"):
print("恭喜你,你赢了!")
else:
print("很遗憾,你输了!")
play_again = input("是否再来一局?(是/否):")
play_again = play_().lower()
if play_again != "是":
break
rock_paper_scissors()
发布者:admin,转转请注明出处:http://www.yc00.com/web/1713014313a2166830.html
评论列表(0条)