0
Can anyone please explain me , why list C doesn't store the integer value? Thanks in advance 😊
5 ответов
+ 2
By appending <curr> we are appending a Node instance. By appending <curr>.data we only append the respective Node data.
Idk what those numbers are, but I doubt those are memory addresses. Maybe some senior Python knows ...
Maybe you can review this from SoloLearn to understand why we refer the next Node to iterate items
https://www.sololearn.com/learn/634/?ref=app
+ 1
Ipang, i wanted to how, appending <curr> it stores address in List <C>. How the line <Curr = curr.next> works 😅.
+ 1
Thanks a lot Ipang😊
0
Inside the definition of __str__(self):
Inside the while...loop you should append curr.data, not <curr>. And you should add curr.data to <c> before reassigning <curr> to its next reference
while curr:
out += str(curr.data) + '->'
c.append(curr.data)
curr = curr.next
0
Anytime buddy 👌