当前位置:网站首页>List exercises after class
List exercises after class
2022-07-03 07:26:00 【GAVL】
DAY05 List exercises
1、 A set of achievements 67,90,-20,105,88,92, Please change the negative score to 0, exceed 100 Of is set to 100, Then the output .
# 1、 A set of achievements 67,90,-20,105,88,92, Please change the negative score to 0, exceed 100 Of is set to 100, Then the output .
from typing import List
lst = [67, 90, -20, 105, 88, 92]
for i in range(len(lst)):
if lst[i]<0:
lst[i]=0
elif lst[i]>100:
lst[i]=100
print(lst)
2、 Input 5 Results of students , Descending output , And find the average score
# 2、 Input 5 Results of students , Descending output , And find the average score
a = (input(" Please enter the scores of five students :"))
a1 = a.split(',')
lst1 = list(a1)
print(lst1)
lst1.sort(reverse=True)
print(lst1)
print(len(lst1))
sum = 0
for i in range(0, len(lst1)):
sum += int(lst1[i])
print(" Average score :" + str(sum / len(lst1)))
--------------------------------------
lst2=[]
for i in range(5):
score=int(input(" Please enter the grade :"))
lst2.append(score)
sum+=score
lst2.sort(reverse=True)
print(lst2)
print(f' The average is {
sum/5}')
3、 Determine whether a sequence is orderly
lst3 = [12, 12,12,12,12]
if lst3==sorted(lst3):
print(' yes ')
elif lst3==sorted(lst3,reverse=False):
print(' yes ')
else:
print(' no ')
边栏推荐
- Vertx's responsive MySQL template
- FileInputStream and fileoutputstream
- Leetcode 198: 打家劫舍
- 【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5
- Arduino 软串口通信 的几点体会
- Unified handling and interception of exception exceptions of vertx
- [set theory] Stirling subset number (Stirling subset number concept | ball model | Stirling subset number recurrence formula | binary relationship refinement relationship of division)
- 你开发数据API最快多长时间?我1分钟就足够了
- 树莓派更新工具链
- IP home online query platform
猜你喜欢

【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5

Le Seigneur des anneaux: l'anneau du pouvoir

docker建立mysql:5.7版本指定路径挂载不上。

TreeMap

SecureCRT password to cancel session recording

Common architectures of IO streams

7.2 brush two questions

Map interface and method

Final, override, polymorphism, abstraction, interface

IPv4 address
随机推荐
高并发内存池
[solved] win10 cannot find a solution to the local group policy editor
论文学习——鄱阳湖星子站水位时间序列相似度研究
【最詳細】最新最全Redis面試大全(50道)
Summary of Arduino serial functions related to print read
Leetcode 213: 打家劫舍 II
VMWare网络模式-桥接,Host-Only,NAT网络
SecureCRT取消Session记录的密码
《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
Arduino 软串口通信 的几点体会
Use of other streams
691. Cube IV
TypeScript let与var的区别
TCP cumulative acknowledgement and window value update
Realize the reuse of components with different routing parameters and monitor the changes of routing parameters
The babbage industrial policy forum
LeetCode
Advanced API (byte stream & buffer stream)
How long is the fastest time you can develop data API? One minute is enough for me
691. 立方体IV