In <1cc14787-7061-45c9-a70e-1b16e3f5e...@googlegroups.com> Jake Kobs 
<kob...@gmail.com> writes:

> Here is the code:

> def getHigh(pints, highPints):
>     highPints = pints[0]
>     counter = 1
>     while counter < 7:
>         if (pints[counter] > highPints):
>             highPints = pints[counter]
>             counter = counter + 1
>     return highPints

getHigh() goes into an infinite loop if pints[counter] is less than or
equal to highPints.


> def getLow(pints, lowPints):
>     lowPints = pints[0]
>     counter = 1
>     while counter < 7:
>         if (pints[counter] < lowPints):
>             lowPints = pints[counter]
>             counter = counter + 1
>     return lowPints

And getLow() has a very similar problem.

I suspect you want to unindent the 'counter = counter + 1' statement
so that it is NOT inside the 'if' statement.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to