0

Can anyone please explain me , why list C doesn't store the integer value? Thanks in advance 😊

https://code.sololearn.com/c2F1I5R28UzF/?ref=app

18th Dec 2021, 4:22 PM
Surya T
Surya T - avatar
5 Respuestas
+ 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
22nd Dec 2021, 7:52 AM
Ipang
+ 1
Ipang, i wanted to how, appending <curr> it stores address in List <C>. How the line <Curr = curr.next> works 😅.
22nd Dec 2021, 5:51 AM
Surya T
Surya T - avatar
+ 1
Thanks a lot Ipang😊
22nd Dec 2021, 7:58 AM
Surya T
Surya T - avatar
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
18th Dec 2021, 5:29 PM
Ipang
0
Anytime buddy 👌
22nd Dec 2021, 7:59 AM
Ipang