Input Format
The first line of input contains , the number of elements in the linked list.
The next lines contain one element each, which are the elements of the linked list.
The next lines contain one element each, which are the elements of the linked list.
Output Format
Print the integer data for each element of the linked list . There should be one element per line.
Sample Input
2
16
13
Sample Output
def printLinkedList(head):
temp=head
while(temp):
if (temp==None):
pass
else:
print(temp.data)
temp=temp.next
if __name__ == '__main__':
llist_count = int(input())
llist = SinglyLinkedList()
for _ in range(llist_count):
llist_item = int(input())
llist.insert_node(llist_item)
printLinkedList(llist.head)
0 Comments