标签:NPU .so dom append 游戏 lse *** sort user
""" Author:Cairo """ import random # 1.计算1~100以内所有能被3或者17整除的数的和 # n = 0 # for i in range(1,101): # if i % 3 == 0 or i % 17 == 0: # n += i # print(n) # # 2.计算1~100以内能被7或者是3整除,但是不能同时被这两个数整除的数的个数 # n = 0 # for i in range(1,101): # if (i % 7 == 0 or i % 3) == 0 and (i % 7 != 0 or i % 3 != 0): # n += 1 # print(n) # 3.计算200~500以内能被7整除但不是偶数的数的个数。 # # n = 0 # for i in range(200,501): # if (i % 7 == 0) and ( i % 2): # n += 1 # print(n) # 4.押宝游戏: # # 开始游戏 -> 投入赌金【一次性投入】 -> # # 循环 :押宝【5块钱一次】 -> 开奖 --》中奖/未中奖 --》用户输入是否继续 【当余额为0则自动退出游戏】 # print("*****开始游戏*****") # money = 5000 # while True: # mun = random.randint(1, 10) # InputD = input("请输入金额>>:") # InpuT = InputD.isdigit() # if InpuT == True: # InputD = int(InputD) # Input = input("请输入/大/小>>:") # if InputD < money: # if mun > 5: # if Input == "大": # print("恭喜你中奖了!!!") # money += InputD # else: # print("你并没有中奖!!!") # money -= InputD # else: # if Input == "小": # print("恭喜你中奖了!!!") # money += InputD # else: # print("你并没有中奖!!!") # money -= InputD # print("你的余额为 %d "%money) # UserI = input("‘C’继续/任意键退出") # if UserI == "C": # continue # else: # break # 5。百钱买百鸡,现有100文钱,公鸡5文钱一只,母鸡3文钱一只,小鸡一文钱3只,要求:公鸡,母鸡,小鸡都要有,把100文钱花完,买的鸡是整数。多少只公鸡,多少只母鸡多少只小鸡? # for fat in range(100): # for math in range(100): # for min1 in range(100): # if ((math * 3 ) + (min1 / 3 ) + (fat * 5) == 100) and (fat!=0 and math!=0 and min1!=0) and (fat+math+min1==100): # print("公鸡有 %d 只!母鸡有 %d 只!小鸡有 %d 只!"%(fat,math,min1)) #打印*号 # Input = int(input("请输入一个数字>>:")) # for i in range(1,Input+1): # for k in range(i,Input+1): # if i == k and i%2!=0: # print(("*"*i).rjust(10," ")) #打印菱形 # Input = int(input("请输入一个数字>>:")) # for i in range(1,Input+1): # if i%2!=0: # print(("*"*i).center(30," ")) # # nm = [] # for n in range(1,Input+1): # nm.append(n) # nm.sort(reverse=True) # for km in nm: # km -= 1 # if km % 2 != 0 and nm[1] != km : # print(("*" * km).center(30, " ")) #n到n的水仙花数 # InpuT1 = int(input("请输入一个开始的数字>>:")) # InpuT = int(input("请输入一个结束数字>>:")) # num = 0 # for Input in range(100,InpuT+1): # num1 = Input % 10 # num2 = Input // 10 % 10 # num3 = Input // 100 # if Input == pow(num1,3) + pow(num2,3) + pow(num3,3): # num += 1 # else: # pass # print(num)
标签:NPU .so dom append 游戏 lse *** sort user
原文地址:https://www.cnblogs.com/ArtisticMonk/p/9052728.html