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()
时间: 2024-12-30 01:45:43