title: conditional statements - intro to python
body: <p>I have been going through an introduction to python booklet and have been stuck on the following question. the question is outlined below and my attempt follows after the question. the issue I am having is that total is fixed to the first number entered, while the question would like total to equal every new number entered. I hope this makes sense. Thanks in Advance.  </p>
  
  <p>Write a program that takes a series of numbers (ending in 0). If the current number is the same as the previous number, it says <code>Same'; if the current number is greater than the previous one, it says</code>Up', and if it's less than the previous one, it says `Down'. It makes no response at all to the very rst number. For example, its output for the list 9, 9, 8, 5, 10, 10, 0, would be Same, Down, Down, Up, Same (comparing, in turn, 9 and 9, 9 and 8, 8 and 5, 5 and 10, 10 and 10). You may assume there are at least two numbers in the input.</p>
  
  <p>Enter the first number: 9</p>
  
  <p>Enter the next number (0 to finish): 9</p>
  
  <p>Same</p>
  
  <p>Enter the next number (0 to finish): 8</p>
  
  <p>Down</p>
  
  <p>Enter the next number (0 to finish): 5</p>
  
  <p>Down</p>
  
  <p>Enter the next number (0 to finish): 10</p>
  
  <p>Up</p>
  
  <p>Enter the next number (0 to finish): 10</p>
  
  <p>Same</p>
  
  <p>Enter the next number (0 to finish): 0</p>
  
  <p>-- </p>
  
  <p><strong>My attempt is below</strong> </p>
  
  <pre><code>print('please enter the first number: (0 to finish) ', end = '')
  d = input()
  total = int(d)
  finished = False
  while not finished:
      print('please enter the next number: (0 to finish) ', end = '')
      s = input()
      num = int(s)
      if num != 0:
          if num &lt; total:
               print('down')
          elif num &gt; total:
              print('Up') 
          elif num == total:
              print('Same') 
      else:
         finished = True
  </code></pre>