蓝桥杯备赛(1)

http://oj.shengtongedu.com/problem/10012
http://oj.shengtongedu.com/problem/10015
http://oj.shengtongedu.com/problem/10047

题目链接

http://oj.shengtongedu.com/problem/10012

 

本题目知识点 输入 字符串分割  数据类型转换  排序

list1=[int(i) for i in input().split()]
list1.sort()
list1=map(str,list1)
print(' '.join(list1))
#这里用来两种方式对可迭代对象中的数据的数据类型进行转换
#分别是列表推导式和map函数,这两个方法要求熟练掌握

http://oj.shengtongedu.com/problem/10015

 本题知识点 :一些作用于可迭代对象的函数如 sum()len() ,保留指定位数小数点

list1=[float(i) for i in input().split()]
#因为数据是小数这里特地用了float来转化
mid=sum(list1)/len(list1)
list2= [i  for i in list1 if i >= 35] 
#用列表推导式来 判断有多少天是高温天 怎么样有没有爱上列表推导式
print(len(list2))
print('%.2f'%mid)

http://oj.shengtongedu.com/problem/10047

 本题知识点:多行输入?? 比第二题要简单一点 列表推导式梅开三度

list1=[int(i) for i in input().split()]
n=int(input())
list2=[i for i in  list1 if (int(i)) >= 30+n]
print(len(list2))

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值