Commit e6ad8839 by BellCodeEditor

auto save

parent 61e409ea
Showing with 11 additions and 0 deletions
p=input("你要出什么(剪刀/石头/布)") p=input("你要出什么(剪刀/石头/布)")
#判断玩家输入的东西
print("玩家出"+p) print("玩家出"+p)
#输出玩家选择
import random import random
#调出random
list=("石头","剪刀","布") list=("石头","剪刀","布")
#建立列表
l=random.choice(list) l=random.choice(list)
#调出随机函数
print("电脑出",l) print("电脑出",l)
#输出函数
if p in list: if p in list:
#判断玩家选择是否在列表中
if p==l: if p==l:
#平局
print("平局") print("平局")
elif (p=="剪刀" and l=="石头") or (p=="石头" and l=="布") or (p=="布" and l=="剪刀"): elif (p=="剪刀" and l=="石头") or (p=="石头" and l=="布") or (p=="布" and l=="剪刀"):
#玩家输
print("lose") print("lose")
else: else:
#玩家赢
print("Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh") print("Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
else: else:
print("说错了") 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