Commit 8ff1da8b by BellCodeEditor

save project

parent b5c6bbbe
Showing with 28 additions and 0 deletions
import random
print("*"*100)
print(" 剪刀 石头 布")
print("按q键退出")
print("*"*100)
while True:
hand=input("系统:请玩家输入(剪刀/石头/布):")
if hand=="q":
print("系统:游戏结束!")
exit()
print("系统:玩家出拳,%s"%hand)
com=["剪刀","石头","布"]
computer=random.choice(com)
print("系统:电脑出拳,%s"%computer)
if hand in com:
if hand==computer:
print("系统:平局!")
elif hand=="剪刀" and computer=="布" or hand=="石头" and computer=="剪刀" or hand=="布" and computer=="石头":
print("系统:玩家获胜!")
else:
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