首页 > 编程语言 > 详细

Python_猜大小

时间:2016-12-28 19:49:04      阅读:289      评论:0      收藏:0      [点我收藏+]
 1 # 需要在python3上执行
 2 import random
 3 def game ():
 4     point1 = random.randrange(1,7)
 5     point2 = random.randrange(1,7)
 6     point3 = random.randrange(1,7)
 7     print("<<<<<<<GAME START>>>>>>>")
 8     result = point3 + point2 + point1
 9     Big = range(11,19)
10     Small = range(3,11)
11     cai = input("Big or Small: ")
12     print(<<<<<<ROLE THE DICE!>>>>>>)
13     i = 1
14     if cai == Big:
15         if result in Big:
16             print("点数是"+ str([point3, point2, point1]),"You Win!")
17         else:
18             print("点数是"+ str([point3, point2, point1]),"You Lose!")
19     elif cai == Small:
20         if result in Small:
21             print("点数是"+ str([point3, point2, point1]),"You Win")
22         else:
23             print("点数是"+ str([point3, point2, point1]),"You Lose!")
24     else:
25         print("仅允许输入 “Big” 或 “Small”")
26         game()
27     while i>0:
28         game()
29 game()

 

Python_猜大小

原文:http://www.cnblogs.com/xuelei-0728/p/6230157.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!