Commit b1e8b6b7 by BellCodeEditor

save project

parent d72f77f7
Showing with 28 additions and 7 deletions
{
"workbench.colorTheme": "Default Dark+"
}
\ No newline at end of file
import random# 玩家出拳 import random
player=input("please play with the computer:stone/jiandao/bu") # 出拳选项
print("your ansuer is"+player) list1=['石头','剪刀','布']
list=('shitou,jiandao,bu') # 胜利选项, 前>后
com=random.choice(list) comp = [('石头', '剪刀'), ('剪刀', '布'), ('布', '石头')]
print("com is,"+com) # 玩家出拳
\ No newline at end of file player=input(f"please play with the computer:, {'/'.join(list1)}")
print("your ansuer is:", player)
# 判断是否出正确的拳
if player not in list1:
print(f'Error: your answer not in {list1}')
else:
# 电脑随机出拳
com=random.choice(list1)
print("com is:", com)
# 如果 (玩家出拳, 电脑出拳) 在胜利选项内,则胜利
if (player, com) in comp:
print(f'{player} killed {com}, You won!')
# 平局
elif player == com:
print(f"You're equaled. Try again!")
else:
print(f'Oops... {com} killed {player}, You loose!')
\ 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