游戏:石头 剪子 布
上一节
下一节
'''
设计一个“石头,剪子,布”游戏
(a)布 包 石头
(b)石头 砸 剪子
(c)剪子 剪破 布
'''
from random import *
guess_list = ("石头", "剪子", "布")
win_combination = (("布", "石头"), ("石头", "剪子"), ("剪子", "布"))
computer = choice(guess_list)
people = input('请输入 石头 剪子 布\n').strip()
if people in guess_list:
print('电脑的选择是:',computer)
if computer == people:
print( "\n\n打了平手")
elif (computer, people) in win_combination:
print('\n\n电脑胜')
else:
print( "\n\n我胜")

