Commit 1b7cbf39 by BellCodeEditor

save project

parent d5dedf39
Showing with 59 additions and 6 deletions
import random
p = input("请出拳/剪刀/石头/布:")
print("玩家出拳"+p)
l = ["剪刀","石头","布"]
c = random.choice(l)
print("电脑出拳"+c)
\ No newline at end of file
while True:
p = input("请出拳/剪刀/石头/布:")
print("玩家出拳"+p)
l = ["剪刀","石头","布"]
c = random.choice(l)
print("电脑出拳"+c)
if p in l:
if p == c:
print('平局')
elif p =='石头':
if c=='剪刀':
print("玩家赢")
if c=='布':
print("电脑赢")
elif p =='剪刀':
if c=='布':
print("玩家赢")
if c=='石头':
print("电脑赢")
elif p =='布':
if c=='石头':
print("玩家赢")
if c=='剪刀':
print("电脑赢")
else:
print ("输入错误,请重新出拳")
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