title: Python: Function with while loop returns None at the end. How do I remedy this?
body: <p>I am doing an <a href="https://www.hackerrank.com/challenges/cut-the-sticks" rel="nofollow noreferrer">exercise from hackerrank.com</a>.</p>
  
  <p>My main issue with my code is my function returns none with my while loop. </p>
  
  <p>I know I can pass the exercise by not using it as a function but my personal goal is to maintain it as one. Is there a way I can keep my code as a function and not return None? </p>
  
  <p><strong>My Code</strong></p>
  
  <pre><code>def cutOperation(sticks):
      currentLine = sticks
      while len(currentLine) != 0:
          newLine = []
          print len(currentLine)
          for stick in currentLine:
              if stick - min(currentLine) != 0:
                  newLine.append(stick - min(currentLine))
          currentLine = newLine
  
  _ = int(raw_input().strip())
  sticks = map(int,raw_input().strip().split(' '))
  #First Test Case for sticks = 5 4 4 2 2 8
  
  print cutOperation(sticks)
  </code></pre>
  
  <p><strong>Result after running code</strong></p>
  
  <pre><code>6
  4
  2
  1
  None
  #How do I not return none?
  </code></pre>