Python Higher-Lower program (not higher-lower game)
<p>I'm a 1st year CS student been struggling over the past few days on this lab task I received for python(2.7):</p>

<hr>

<p>Write a Python script named higher-lower.py which:
first reads exactly one integer from standard input (10, in the example below),
then reads exactly five more integers from standard input and
for each of those five values outputs the message higher, lower or equal depending upon whether the new value is higher than, lower than or equal to the previous value.</p>

<p>(Must have good use of a while loop)</p>

<p>(Must not use a list)</p>

<p>Example standard input:</p>

<pre><code>10
20
10
8
8
12
</code></pre>

<p>Example standard output:</p>

<pre><code>higher
lower
lower
equal
higher
</code></pre>

<p>(1 string per line)</p>

<hr>

<p>I have a working solution but when I upload it for correction I am told it's incorrect, This is my solution:</p>

<pre><code>    prev = input()
    output = ""
    s = 1
    while s &lt;= 5:
       curr = input()

       if prev &lt; curr:
          output = output + "higher\n"
       elif curr &lt; prev:
          output = output + "lower\n"
       else:
          output = output + "equal\n"

       s = s + 1
       prev = curr
    print output
</code></pre>

<p>I think it's incorrect because each higher/lower/equal is printed on a single string over 5 lines, where the task wants each higher/lower/equal to be printed as an individual string on each line.</p>

<p>Could anyone give me any hints in the right direction? I searched stackoverflow as well as google for a similar problem and couldn't find anything related to this. Any help would be appreciated! </p>

<p>Given your description, I suspect that the validation program wants to see a single result after each additional input.  Have you tried that?</p>

<pre><code>while s &lt;= 5:
   curr = input()

   if prev &lt; curr:
      print "higher"
   elif curr &lt; prev:
      print "lower"
   else:
      print "equal"

   s = s + 1
   prev = curr
</code></pre>

python