当前位置:网站首页>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 ')
边栏推荐
- Use of other streams
- 4everland: the Web3 Developer Center on IPFs has deployed more than 30000 dapps!
- Interview questions about producers and consumers (important)
- New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears
- Distributed lock
- VMware network mode - bridge, host only, NAT network
- C WinForm framework
- Introduction of transformation flow
- The underlying mechanism of advertising on websites
- 【已解决】Unknown error 1146
猜你喜欢

最全SQL与NoSQL优缺点对比

TreeMap

【已解决】SQLException: Invalid value for getInt() - ‘田鹏‘

Deep learning parameter initialization (I) Xavier initialization with code

Map interface and method

691. Cube IV

Recursion, Fibonacci sequence

在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储

Understanding of class

Why is data service the direction of the next generation data center?
随机推荐
1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
Raspberry pie update tool chain
[set theory] order relation (partial order relation | partial order set | example of partial order set)
Vertx restful style web router
Jeecg request URL signature
【无标题】
Distributed ID
Common architectures of IO streams
树莓派更新工具链
Some experiences of Arduino soft serial port communication
docket
《指环王:力量之戒》新剧照 力量之戒铸造者亮相
Download address collection of various versions of devaexpress
New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears
Industrial resilience
JS monitors empty objects and empty references
Unified handling and interception of exception exceptions of vertx
Circuit, packet and message exchange
Final, override, polymorphism, abstraction, interface
"Moss ma not found" solution