A.使用len(列表名)测量元素的个数names_list=["zhangsan","lisi","wangwu"]print(len(names_list))
B.使用列表名[下标]获取列表的某个元素,例如:names_list=["zhangsan","lisi","wangwu"]print(names_list[2])
C.向列表中添加新元素有三个方法:append、extend、insert,例如:names_list=["zhangsan","lisi","wangwu"]names_list.append("zhaoliu")names_list.extend(["zhaoliu","liqi"])names_list.insert(1,"zhaoliu")print(names_list)
D.已有列表nums=[11,22,33,44,55],使用while循环遍历列表nums=[11,22,33,44,55]i=0 whilei
print(nums[i])i+=1
答案参考说明:本题目答案来自网络整理或转载,具体答案请以官网为准。
答 案:D