+ 1
Help me explain this code plzzz
a = [] a.append(a) print(a) #Output: [[...]]
3 ответов
+ 5
Here's some info on the python built-in constant 'ellipsis'. Read through it. Especially the part about circular references!!
https://python.land/python-ellipsis
+ 1
Why do you want to append a to a?
Use
a = []
a.append(value to append to list)
print (a)
a = []
a.append(5)
print (a)
#output [5]
0
Basically the code should append “a” into the list with variable name “a” i.e a=[“a”]. So when you print(a) you get [“a”].
But the code may not work, because you did not put a in quote. i.e you used a.append(a) instead of a.append(“a”)