首页 > 代码库 > Python_猜大小
Python_猜大小
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_猜大小
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。