当前位置:网站首页>Lesson 016: sequence | after class test questions and answers
Lesson 016: sequence | after class test questions and answers
2022-06-22 21:35:00 【ChaseTimLee】
Test questions :
0. We follow the list 、 The common characteristics of tuples and strings , Call them three together why ?
Sequence , Because they have the following in common :
1) You can get every element by index
2) The default index value is always from 0 Start ( Of course flexible Python Negative index is also supported )
3) You can get a set of elements in a range by sharding
4) There are many operators in common ( Repeat operator 、 Splicing operators 、 Membership operators )
1. What do you use respectively BIF, You can convert an iteratable object to a list 、 Tuples and strings ?
list([iterable]) Converting an iteratable object to a list
tuple([iterable]) Convert iteratable objects to tuples
str(obj) Convert an object to a string
>>> temp = 'I love FishC.com!'
>>> list(temp)
['I', ' ', 'l', 'o', 'v', 'e', ' ', 'F', 'i', 's', 'h', 'C', '.', 'c', 'o', 'm', '!']
2. You can also retell “ iteration ” The concept of ?
Iteration , It's an activity that repeats the feedback process , Its purpose is usually to approach and reach the desired goal or result . Every repetition of a process is called a “ iteration ”, The result of each iteration will be used as the initial value of the next iteration .
3. You think call max(‘I love FishC.com’) What value will be returned ? Why? ?
Returns the :‘v’, Because the string in the computer is in the form of ASCII In the form of code (ASCII Comparison table :http://bbs.fishc.com/thread-41199-1-1.html), Parameters in ASCII The largest code value is ’v’ Corresponding 118.
4. Ah ah , The little kids are so naughty now , Naughty children in the neighborhood , Draw a pattern of the code that the little turtle just wrote , Please restore the code of fish oil ~~

name = input(' Please enter the user name to be found :')
score = [[' Get lost ', 85], [' Night ', 80], [' Pudding ', 65], [' Froude doll ', 95], [' Yijing ', 90]]
IsFind = False
for each in score:
if name in each:
print(name + ' The score for is :', each[1])
IsFind = True
break
if IsFind == False:
print(' The data found does not exist !')
use one's hands :
0. Guess min() This BIF Implementation process
def min(x):
least = x[0]
for each in x:
if each < least:
least = each
return least
print(min('123456789'))
1. In the video we say sum() This BIF There's a flaw , If there is a string type in the parameter, an error will be reported , Please write a new implementation , Automatically “ ignore ” The string in the parameter and return the correct result
def sum(x):
result = 0
for each in x:
if (type(each) == int) or (type(each) == float):
result += each
else:
continue
return result
print(sum([1, 2.1, 2.3, 'a', '1', True]))
边栏推荐
- ICML2022 | 利用虚拟节点促进图结构学习
- 300. longest increasing subsequence ●●
- 2022 group programming TIANTI race L1
- DACL output on Jerry's hardware, DAC output sound of left and right channels [chapter]
- RealNetworks vs. 微软:早期流媒体行业之争
- [redis] cluster and common errors
- [redis]Redis6的事务操作
- 软考必备资料大放送,全科目软考资料都给你备好了!
- 74- how to remedy the loss of Oracle to MySQL for this kind of SQL optimization?
- 2022 question bank and simulated examination for work license of main principals of hazardous chemical business units
猜你喜欢
![When the AUX1 or aux2 channel is used in Jerry's aux mode, the program will reset the problem [chapter]](/img/0a/93e95a3a2a923497d57895508ce92e.png)
When the AUX1 or aux2 channel is used in Jerry's aux mode, the program will reset the problem [chapter]

2022年起重机械指挥考试模拟100题及模拟考试

2022 chemical automation control instrument examination exercises and online simulation examination

鸿蒙第三次培训

53页智慧校园智能化系统设计方案(附下载)

53 page intelligent campus intelligent system design scheme (download attached)

ByteDance proposes a lightweight and efficient new network mocovit, which has better performance than GhostNet and mobilenetv3 in CV tasks such as classification and detection

Redis learning notes
![[redis]配置文件](/img/1c/05c06d59c9efb5983f877822db333c.png)
[redis]配置文件
![Jerry's music mode obtains the directory of playing files [chapter]](/img/2f/efb8a077e3e398cb3b14cfd98a8422.png)
Jerry's music mode obtains the directory of playing files [chapter]
随机推荐
第014-15讲:字符串 (见小甲鱼新版27讲-32讲)| 课后测试题及答案
第025讲:字典:当索引不好用时 | 课后测试题及答案
Jericho uses DP and DM for IO key detection [chapter]
2022年A特种设备相关管理(电梯)考题及模拟考试
86- to attend & lt; SQL writing and rewriting training & gt; 's participants add a second-hand case
[138. copy linked list with random pointer]
ACM. HJ45 名字的漂亮度 ●●
List of outstanding talents: no crystal vibration, one drag, eight burn and upgrade [chapter]
71- analysis of an Oracle DBA interview with Alibaba in 2010
Laravel+ pagoda planning task
85- have you learned any of these SQL tuning tips?
Set up your own website (12)
第018讲:函数:灵活即强大 | 课后测试题及答案
When the AUX1 or aux2 channel is used in Jerry's aux mode, the program will reset the problem [chapter]
Redis的使用场景分享(项目实战)
Objective-C byte size occupied by different data types
[876. intermediate node of linked list]
数据库总结:mysql在开发过程中常见的问题及优化
Simulated 100 questions and simulated examination of hoisting machinery command examination in 2022
73- find the SQL example during the business peak period (report development class)