title: Insert At the beginning of Linked List
body: <pre><code>class Node:
  def __init__(self,data):
      self.data=data
      self.next=None
  
  head=Node(10)
  head.next=Node(20)
  head.next.next=Node(30)
  head.next.next.next=Node(40)
  head.next.next.next.next=Node(50)
  
  def insertAtBegnning(head,x):
      temp=Node(100)
      temp.next=head
      return temp
  head =insertAtBegnning(head,90)
  </code></pre>
  <p>1.In the above function i am able to add new node at the beginning but i tired it another way as below where i am not able to add new node at the beginning of a linked list.</p>
  <pre><code>def insertAtBegning(head,x):
      temp=head
      head=Node(x)
      head.next=temp
      return head
  
  insertAtBegning(head,100)
  
  def displayLinkedList(head):
      curr=head
      while(curr!=None):
         print (curr.data)
         curr=curr.next
  
  displayLinkedList(head)
  </code></pre>
  <p>result: I am getting 10,20,30,40,50 but where i should get 100,10,20,30,40,50</p>
  <p>2.can any one tell me  where i am going wrong in the above function</p>