1) Which of the following commands will create a list? a) list1 = list() b) list1 = [] c) list1 = list([1, 2, 3]) d) All of the above 2) What is the output when we execute list(“hello”)? a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] b) [‘hello’] c) [‘llo’] d) [‘olleh’] 3) Suppose list Example is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)? a) 5 b) 4 c) None d) Error 4) Suppose list1 is [2445,133,12454,123], what is max(list1)? a) 2445 b) 133 c) 12454 d) 123 5) Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)? a) 3 b) 5 c) 25 d) 1 6) Suppose list1 is [1, 5, 9], what is sum(list1)? a) 1 b) 9 c) 15 d) Error 7) To shuffle the list(say list1) what function do we use? a) list1.shuffle() b) shuffle(list1) c) random.shuffle(list1) d) random.shuffleList(list1) 8) Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? a) print(list1[0]) b) print(list1[:2]) c) print(list1[:-2]) d) All of the above 9) Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? a) Error b) None c) 25 d) 2 10) Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]? a) [2, 33, 222, 14] b) Error c) 25 d) [25, 14, 222, 33, 2]
0%
Lists in Python
共享
共享
共享
由
Jashanpreet
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
随堂测验
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?