[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
试题1:请使用 Python 中的循环打印输出从1到100的所有奇数。
试题2:请将字符串“你好SsS我正在学 Python@#@#现在需要&*&*&修改字串”中的符号变成一个空格,需要输出的格式为:“你好
我正在学 Python 现在需要 修改字符串”。
试题3:输出9×9乘法口诀表。
试题4:请写出一个函数,当输入函数变量月利润为 I 时,能返回应发放奖金
的总数。例如,输出“利润为100000元时,应发放奖金总数为10000元”。
其中,企业发放的奖金根据利润提成。利润( I )低于或等于10力元时,奖金可提10%:利润高于10万元,低于20万元时,低10力元的部分按10
%提成,高于10万元的部分,可提成7.5%:利润在20万元到40力元之间时,高于20万元的部分可提成5%;利润在40万元到60万元之间时,高于40
万元的部分可提成3%;利润在60力元到100力元之间时,高于60万元的部分可提成
1.5%:利润高于100万元时,超过100力元的部分按1%提成。
试题5:用字典的值对字興进行排序,将{1:2,3:4,4:3,2:1,0:0}按照字典的值
从大到小进行排序。
试题1:
for i in range(100): if i%2 not in [0]: print(i) #方法很多
试题2:
s = input() str = s.replace('SsS',' ').replace('&*&*&',' ').replace('@#@#','
') print(str) import re s = input() str1 = re.sub('[@#Ss&&*%]+',' ',s)
print(str1)
试题3:
for i in range(1,10): for j in range(1,10): if i>=j:
print('{0:.0f}*{1:.0f}={2:.0f}\t'.format(j,i,i*j),end=" ")
#print("%d*%d=%d\t"%(j,i,i*j),end=" ") print(" ")
试题4:
def profit(I): c=10000 I /= c; if I<=10: return I*0.1*c elif I>10 and I<=20:
return (1+(I-10)*0.075)*c elif I>20 and I<=40: return (1.75+(I-20)*0.05)*c elif
I>40 and I<=60: return (2.75+(I-40)*0.03)*c elif I>60 and I<=100: return
(3.35+(I-60)*0.015)*c else: return (3.95+(I-100)*0.01)*c I=int(input()) pro =
profit(I) print("利润为%d元,奖金总数为%d元" %(I,pro))
试题5:
import operator x={1:2,3:4,4:3,0:0}
sorted_x=sorted(x.items(),key=operator.itemgetter(1)) print(sorted_x)
#operator.itemgetter(1)获取对象的第一个域的值