标签:role int art port ice random range else import
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()
标签:role int art port ice random range else import
原文地址:http://www.cnblogs.com/xuelei-0728/p/6230157.html