title: convert linked list to number in python
body: <pre><code>class Node(object):
      def __init__(self,value=None):
          self.value = value
          self.next = None
  </code></pre>
  
  <p>the above class is the node defintion</p>
  
  <pre><code>def number_to_list(number):
      head,tail = None,None
      p = True
      for x in str(number):
          if x=='-':
             p = False
             continue
          else:
            if p:
               node = Node(int(x))
            else:
               node = Node(int("-"+x))
          if head:
             tail.next = node
          else:
              head = node
          tail = node
      return head
      pass
  </code></pre>
  
  <p>this is the code for conversion of a number to linked list
  for example,</p>
  
  <pre><code> assert [1,2,0] == number_to_list(120)
   assert [0] == number_to_list(0)
   assert [-1, -2, 0] == number_to_list(-120)
  </code></pre>
  
  <p>but, how should i convert from linked list to number</p>
  
  <pre><code> def list_to_number(head)
   pass
  </code></pre>
  
  <p>for example,</p>
  
  <pre><code> assert 120 == list_to_number([1,2,0])
   assert -120 == list_to_number([-1,-2,0])
  </code></pre>
  
  <p>i am trying from last 3 days but i didn't encounter any solution please help me from out of this</p>