标签:重复 sort style form 这一 color div pre sqrt
list =[1,2,3,4] list1=[] for one in list: for owe in list: for qwe in list: if owe!=one and owe!=qwe and one!=qwe: a= ‘%d%d%d‘%(one,owe,qwe) list1.append(a) print(list1) #方法二 for i in range(1,5): for j in range(1,5): for k in range(1,5): if i!=k and i!=j and j!=k: print(
bouns1=100000*0.1 bouns2=bouns1+100000*0.75 bouns3=bouns2+200000*0.5 bouns4=bouns3+400000*0.3 bouns5=bouns4+600000*0.15 i = int(input(‘input gain:\n‘)) if i<=100000: bouns=i*0.1 elif i<=200000: bouns = bouns1+(i-100000)*0.075 elif i<=400000: bouns = bouns2+(i-200000)*0.05 elif i<=600000: bouns = bouns3+(i-400000)*0.03 elif i<=1000000: bouns = bouns4+(i-600000)*0.015 else: bouns = bouns5+(i-1000000)*0.01 print(‘bouns=‘,bouns)
import math for i in range(100000): #转化为整型 x=int(math.sqrt(i+100)) print(x) y= int(math.sqrt(i+268)) # print(y) if (x*x==(i+100)) and (y+y==(i+268)): print(i) #方法二 for i in range(1,1000): for j in range(1,1000): for k in range(1,1000): if (i+100)==j*j and (i+268)==k*k: print(i)
year = int(input(‘输入某年某月某日,判断这一天是一年的第几天\n请输入年:‘)) month=int(input(‘请输入月:‘)) day=int(input(‘请输入日:‘)) Day_month=[31,28,31,30,31,30,31,31,30,31,30,31] if year%4==0 and year%100!=0: Day_month[1]=29 print(‘这一天是这一年的第{}天‘.format(sum(Day_month[0:month-1])+day)) 方法二 import datetime y = int(input(‘请输入4位数字的年份:‘)) #获取年份 m = int(input(‘请输入月份:‘)) #获取月份 d = int(input(‘请输入是哪一天:‘)) #获取“日” targetDay = datetime.date(y, m, d) #将输入的日期格式化成标准的日期 dayCount = targetDay - datetime.date(targetDay.year - 1, 12, 31) #减去上一年最后一天 print(‘%s是%s年的第%s天。‘% (targetDay, y, dayCount.days))
05:输入三个整数x,y,z请把这三个数由小到大输出
l=[] for i in range(3): x=int(input(‘请输入数字:\n‘)) l.append(x) l.sort() print(l)
06:用*号输出字母c的图案
print(‘*‘*10) for i in range(5): print(‘*‘) print(‘*‘*10)
标签:重复 sort style form 这一 color div pre sqrt
原文地址:https://www.cnblogs.com/kelly11/p/11814014.html