Created
February 19, 2018 00:17
-
-
Save akshaynanavati/2a12725c0d920757f60bb5561481b438 to your computer and use it in GitHub Desktop.
Node implementation in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
def __init__(self, data, next=None): | |
self.data = data | |
self.next = next | |
def __str__(head): | |
s = '' | |
while head: | |
s += '{} -> '.format(head.data) | |
head = head.next | |
s += 'None' | |
return s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment