43. (单选题)列表ls = [['Tom', 24], ['Jack', 18], ['Ada', 20]]中的每个子列表第二个元素为年龄,按年龄排序输出,正确的程序是:
A. ls = [['Tom', 24], ['Jack', 18], ['Ada', 20]]ls.sort()print(ls)
B. ls = [['Tom', 24], ['Jack', 18], ['Ada', 20]]ls.sort(key=lambda x: x[1])print(ls)
C. ls = [['Tom', 24], ['Jack', 18], ['Ada', 20]]ls.sort(key=lambda x: x[0])print(ls)
D. ls = [['Tom', 24], ['Jack', 18], ['Ada', 20]]ls.sort(key=lambda x: x[2])print(ls)
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-0bea-c01a-2cf5d6189000.html
点击查看答案
160. (判断题)元组的访问速度比列表要快一些,如果定义了一系列常量值,并且主要用途仅仅是对其进行遍历而不需要进行任何修改,建议使用元组而不使用列表。
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-f4dc-c01a-2cf5d6189000.html
点击查看答案
155. (判断题)列表是不可变数据类型
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-ec95-c01a-2cf5d6189000.html
点击查看答案
159. (判断题)元组是不可变的,不支持列表对象的inset()、remove()等方法,也不支持del命令删除其中的元素,但可以使用del命令删除整个元组对象。
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-f303-c01a-2cf5d6189000.html
点击查看答案
127. (单选题)写出下面代码的运行结果。Plain Textdef Sum(a, b=3, c=5):print(a,b,c)Sum(a=8, c=2)
A. 8 2
B. 8,2
C. 8 3 2
D. 8,3,2
解析:答案解析:
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-b37a-c01a-2cf5d6189000.html
点击查看答案
78. (单选题)定义一个函数如下:def showNnumber(numbers):for n in numbers:print(n)下面那个选项在调用函数时会报错( )
A. showNumer([2,4,5])
B. showNnumber(3.4)
C. showNnumber('abcesf')
D. showNumber((12,4,5))
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-53d7-c01a-2cf5d6189000.html
点击查看答案
80. (单选题)Python中实现多个条件判断需要用到( )语句与if语句的组合。
A. else
B. elif
C. pass
D. else if
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-5842-c01a-2cf5d6189000.html
点击查看答案
23. (多选题)ls = [25, 13, 36, 1]lst = [88]将列表lst中的元素加到列表ls末尾,输出列表[25, 13, 36, 1, 88]的正确的选项有:
A. ls = [25, 13, 36, 1]lst = [88]lsⱣⱤnew = ls + lstprint(lsⱣⱤnew)
B. ls = [25, 13, 36, 1]lst = [88]lsⱣⱤnew = ls.extend(lst)print(lsⱣⱤnew)
C. ls = [25, 13, 36, 1]lst = [88]ls.extend(lst)print(ls)
D. ls = [25, 13, 36, 1]lst = [88]lsⱣⱤnew = ls.extend(lst)print(ls)
https://www.shititong.cn/cha-kan/shiti/000dded1-b61d-e0b5-c01a-2cf5d6189000.html
点击查看答案
96. (单选题)表达式3*4**2//8%7的计算结果是()
https://www.shititong.cn/cha-kan/shiti/000dded1-b61e-7945-c01a-2cf5d6189000.html
点击查看答案
35. (单选题)表示整数num能被4整除的表达式为:
A. num * 4 == 0
B. num // 4 == 0
C. num / 4 == 0
D. num % 4 == 0
https://www.shititong.cn/cha-kan/shiti/000dded1-b61d-faa1-c01a-2cf5d6189000.html
点击查看答案