创建一个玩剪刀石头布游戏的程序
"""
创建一个玩剪刀石头布的程序
"""

import random

choices = ["rock","paper","scissors"]

# 让用户选择其中之一
user_choice = input("请选择石头，剪子还是布: ")

# 检查用户选择是否有效
while user_choice not in choices:
    user_choice = input("请选择石头，剪子还是布: ")

# 计算机随机选择其中之一
computer_choice = random.choice(choices)

# 判断胜负
if user_choice == computer_choice:
    print("平局！")
elif user_choice == "rock" and computer_choice == "scissors":
    print("你赢了！")
elif user_choice == "scissors" and computer_choice == "paper":
    print("你赢了！")
elif user_choice == "paper" and computer_choice == "rock":
    print("你赢了！")
else:
    print("计算机赢了。")

# 输出结果
print("你选择了: "+user_choice+"\n计算机选择了: "+computer_choice)