Commit 9de6bd77 by BellCodeEditor

save project

parent 109ebad9
Showing with 21 additions and 6 deletions
......@@ -10,9 +10,24 @@
# pen.right(144) #向右移动144度,注意这里的参数一定不能变
# pen.end_fill() #结束填充红色
# turtle.done()
qq = input("请选择:")
print("你是:" + qq )
#这是一个人机石头剪刀布游戏
#开始->玩->机->结果
import random
guess_list = ["剪刀","石头","布"]
print(random.choice(guess_list))
\ No newline at end of file
#玩家出拳
computer_guess=["剪刀","石头","布"]
qq = input("请选择:剪刀,石头,布")
if qq not in computer_guess:
print("输入错误")
#计算机出拳
else:
print("玩家出:"+qq)
computer =random.choice(computer_guess)
print("computer:"+computer)
if qq == computer:
print("平")
elif (qq == "石头" and computer == "剪刀") or (qq == "剪刀" and computer == "布") or (qq == "布" and computer == "石头"):
print("赢")
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