class Node:
    def _init_(self, data):
       self.data = data
       self.next = None
 
class LinkedList:
    def _init_(self):
        self.head = None
        self.last_node = None
 
    def append(self, data):
        if self.last_node is None:
            self.head = Node(data)
            self.last_node = self.head
        else:
            self.last_node.next = Node(data)
            self.last_node = self.last_node.next
 
    def display(self):
        current = self.head
        while current is not None:
            print(current.data, end = ' ')
            current = current.next
 
a_llist = LinkedList()
n = int(input('How many elements '))
for i in range(n):
    data = int(input('Enter each element: '))
    a_llist.append(data)
print('The linked list: ', end = '')
a_llist.display()


OUTPUT:
How many elements 4
Enter element: 2
Enter element: 9
Enter element: 3
Enter  element: 2
The linked list: 2 9 3 2
