python 的 石头, 剪刀, 布

2015-05-07 0 558
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');

遇见资源网 python python 的 石头, 剪刀, 布 http://www.ox520.com/15309.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务