python石头, 剪刀, 布源码,python源码,python写的石头,剪


python写的石头,剪刀,布小游戏,仿照豆瓣一个实例。标签: <无>

1.[代码][Python]代码

import random;guess_list = ['石头', '剪刀', '布'];guize = [['石头', '剪刀'], ['剪刀', '布'], ['布', '石头']];computer = random.choice(guess_list);print(computer);people = input("石头, 剪刀, 布:\n").strip();isTrue = True;while isTrue:    if people not in guess_list:        people = input("石头, 剪刀, 布:\n").strip();    else:        isTrue = False;if people == computer:    print('draw');elif [computer, people] in guize:    print('computer is win');else:    print('people is win');

编橙之家文章,

评论关闭