Commit 7be1aedd by BellCodeEditor

save project

parent b1e8b6b7
Showing with 3 additions and 3 deletions
...@@ -5,14 +5,14 @@ list1=['石头','剪刀','布'] ...@@ -5,14 +5,14 @@ list1=['石头','剪刀','布']
comp = [('石头', '剪刀'), ('剪刀', '布'), ('布', '石头')] comp = [('石头', '剪刀'), ('剪刀', '布'), ('布', '石头')]
# 玩家出拳 # 玩家出拳
player=input(f"please play with the computer:, {'/'.join(list1)}") player=input(f"please play with the computer:, {'/'.join(list1)}")
print("your ansuer is:", player) print("你出的拳是:", player)
# 判断是否出正确的拳 # 判断是否出正确的拳
if player not in list1: if player not in list1:
print(f'Error: your answer not in {list1}') print(f'Error: 你的答案不在 {list1}')
else: else:
# 电脑随机出拳 # 电脑随机出拳
com=random.choice(list1) com=random.choice(list1)
print("com is:", com) print("计算机出的拳是:", com)
# 如果 (玩家出拳, 电脑出拳) 在胜利选项内,则胜利 # 如果 (玩家出拳, 电脑出拳) 在胜利选项内,则胜利
if (player, com) in comp: if (player, com) in comp:
print(f'{player} killed {com}, You won!') print(f'{player} killed {com}, You won!')
......
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