Commit 9f1a1650 by BellCodeEditor

save project

parent 5f80b7f9
Showing with 14 additions and 14 deletions
# 玩家出拳
import random
c=['布','剪刀','石头']
c[0]<c[2]
c[1]<c[0]
c[2]<c[1]
computer=random.randint(c)
a=input('请输入:')
if a==c:
print('平局')
if a>c:
print('你赢了')
if a<c:
print('你输了')
\ No newline at end of file
c1=['布','剪刀','石头']
computer=str(random.choices(c1))
print('player:',a)
print('computer:',computer)
if a in c1:
if a==computer:
print('平局')
elif (a=='布' and computer=='石头') or (a=='石头' and computer=='剪刀') or (a=='布' 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