title: Python Collatz Infinite Loop
body: <p>Apologies if similar questions have been asked but I wasn't able to find anything to fix my issue. I've written a simple piece of code for the Collatz Sequence in Python which seems to work fine for even numbers but gets stuck in an infinite loop when an odd number is enter.</p>
  
  <p>I've not been able to figure out why this is or a way of breaking out of this loop so any help would be greatly appreciate. </p>
  
  <pre><code>print ('Enter a positive integer')
  number = (int(input()))
  
  def collatz(number):
      while number !=1:
          if number % 2 == 0:
              number = number/2
              print (number)
              collatz(number)
          elif number % 2 == 1:
              number = 3*number+1
              print (number)
              collatz(number)
  
  collatz(number)
  </code></pre>