python基础,教你从零开始学(python的几个简单面试题分享)

tech2023-10-07  112

题1:L = [1, 2, 3, 5, 6],如何得出 ‘12356’?

L=[1,2,3,4,5,6] s='' for i in L: s += str(i) print(s)

题2:L = [3 , 5,6,1, 2, 3, 6,4 ,6 , 5, 3],如何写一行代码,得出[1 ,2,3,4,5,6]

print(list(set(L)))

题3:L = [1, 2, 3, 2, 5, 3, 2, 5, 3],L[6:]的结果是:

答案:得出的是一个空列表

题4:L=【1,2,3,4,5,6】,如何得出:123456

L=[1,2,3,4,5,6] s='' for i in L: s += str(i) print(s)
最新回复(0)