First python program, syntax error in while loop

Neil Cerutti neilc at norwich.edu
Mon May 6 09:07:20 EDT 2013


On 2013-05-06, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> On 06/05/2013 13:06, Neil Cerutti wrote:
>> On 2013-05-03, John Gordon <gordon at panix.com> wrote:
>>> In <auil2vFijo4U1 at mid.individual.net> Neil Cerutti <neilc at norwich.edu> writes:
>>>
>>>> Not quite yet. Players who guess correctly on the fifth try don't
>>>> get credit.
>>>
>>> Are you sure?  tries is initialized to zero and isn't
>>> incremented for the initial guess.
>>
>> while (number != guess) and (tries < 5):
>>
>> Is the condition that concludes the game.
>>
>> After the game, you are told you lost if tries is not less than
>> five, regardless of if number == guess.
>
> One of these days I'll work out why some people insist on using
> superfluous parentheses in Python code.  Could it be that they
> enjoy exercising their fingers by reaching for the shift key in
> conjunction with the 9 or 0 key?

Superflous parenthesis are sometimes a nice aid to comprehension.

I don't know about the above case, though. I don't think it hurts
anything, but it doesn't add much.

-- 
Neil Cerutti



More information about the Python-list mailing list