发现自己基本的概念不懂,不能理解,有点小悲伤
不会的题:
id是返回内存地址的起始位置,所以即便加了别的内容,它的起始位置也是不变的。
while 循环有点乱
a = [1,2,3,1,2,4,6]
a.sort()
print(a)
b = []
i = 0
while i < len(a):
if a[i] not in b:
b.append(a[i])
else:
i += 1
print(b)
print(i)
print(b)
"""
[1, 1, 2, 2, 3, 4, 6]
[1]
0
[1]
1
[1]
2
[1, 2]
2
[1, 2]
3
[1, 2]
4
[1, 2, 3]
4
[1, 2, 3]
5
[1, 2, 3, 4]
5
[1, 2, 3, 4]
6
[1, 2, 3, 4, 6]
6
[1, 2, 3, 4, 6]
7
[1, 2, 3, 4, 6]
"""