其中一个是问我
a = [1, 2] b = [a]*4 b = tuple(b) b[0][0] = 3 print(b) print(a)
的输出是什么
实际执行结果是
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32 Type "help", "copyright", "credits"&nbs***bsp;"license" for more information. >>> a = [1, 2] >>> b = [a]*4 >>> b = tuple(b) >>> b[0][0] = 3 >>> print(b) ([3, 2], [3, 2], [3, 2], [3, 2]) >>> print(a) [3, 2] >>>我回答是对的,其他也感觉答的还可以,还是一面试完就挂了,可能是kpi面
全部评论
(1) 回帖