赞
踩
import random def random_1 (): random_list = list(range (1001)) b =int (random.choice(random_list)) if b<=50: return "¥¥¥¥¥" elif 50 < b < 200: return "¥¥¥¥" elif 200<= b < 400: return "¥¥¥" elif 400 <= b <=650: return "¥¥" else: return "¥" while 1 : b_5=0 b_4=0 b_3=0 b_2=0 b_1=0 number = input("你要抽几次?请输入:") try: a = int(number) except: print("请输入数字!") else: a = int(number) if a <= 0: print ("请输入数字!") elif a >100000: print("数字太大!请不要超过100000") else: for i in range(a + 1): if i != 0: q = random_1() print(f"{i}. {q}") if q =="¥¥¥¥¥": b_5 += 1 elif q =="¥¥¥¥": b_4 += 1 elif q =="¥¥¥": b_3 += 1 elif q =="¥¥": b_2 += 1 else: b_1 +=1 print (f"恭喜你获得5星:{b_5}个!") print(f"恭喜你获得4星:{b_4}个!") print(f"恭喜你获得3星:{b_3}个!") print(f"恭喜你获得2星:{b_2}个!") print(f"恭喜你获得1星:{b_1}个!")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。