title: Making a collatz program automate the boring stuff
body: <p>I'm trying to write a Collatz program using the guidelines from a project found at the end of chapter 3 of Automate the Boring Stuff with Python. I'm using python <code>3.4.0</code>. Following is the project outline:</p>
  
  <p>Write a function named <code>collatz()</code> that has one parameter named number. If the number is even, then <code>collatz()</code> should print <code>number // 2</code> and return this value. If the number is odd, then <code>collatz()</code> should print and return <code>3 * number + 1</code>. Then write a program that lets the user type in an integer and that keeps calling <code>collatz()</code> on that number until the function returns the value <code>1</code>. </p>
  
  <p>The output of this program could look something like this:</p>
  
  <pre><code>Enter number: 3 10 5 16 8 4 2 1 
  </code></pre>
  
  <p>I am trying to make a function that uses <code>if</code> and <code>elif</code> statements within a while loop. I want the number to print, and then return to the beginning of the loop and reduce itself to one using the Collatz sequence, with each instance of a resulting number being printed as it goes through the loop. With my current code, I'm only able to print the first instance of the number, and that number does not go through the loop after that. Following is my code:</p>
  
  <pre><code>#collatz
  
  print("enter a number:")
  try:
      number = (int(input()))
  except ValueError:
            print("Please enter a valid INTEGER.")
  
  
  def collatz(number):
      while number != 1:
  
          if number % 2==0:
              number = (number//2)
              #print(number)
              return (print(int(number)))
  
          elif nnumber % 2==1:
              number = (3*number+1) 
              #print(number)
              return (print(int(number)))
  
          continue
  
  
  collatz(number)
  </code></pre>