码迷,mamicode.com
首页 > 编程语言 > 详细

python实现猜拳游戏

时间:2018-10-16 13:31:36      阅读:390      评论:0      收藏:0      [点我收藏+]

标签:import   rip   color   pytho   ESS   and   dom   draw   else   

import random;
guess_list = [石头, 剪刀, ];
rules = [[石头, 剪刀], [剪刀, ], [, 石头]];
 
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 rules:
    print(computer is win);
else:
    print(people is win);

 

python实现猜拳游戏

标签:import   rip   color   pytho   ESS   and   dom   draw   else   

原文地址:https://www.cnblogs.com/zijue/p/9797168.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!