[Tutor] How to print something just after 3 attempts?
Mark Lawrence
breamoreboy at yahoo.co.uk
Tue Jul 17 19:19:55 CEST 2012
On 17/07/2012 17:51, Brian van den Broek wrote:
> On 17 Jul 2012 12:39, "Mark Lawrence" <breamoreboy at yahoo.co.uk> wrote:
>>
>> On 17/07/2012 16:28, Paul McNally wrote:
>
> <snip enough context to perhaps have lost attributions>
>
>>> I was able to get it working like this...
>>>
>>> password = "foobar"
>>> attempt = 0
>>> while (password != "unicorn") and (attempt <= 3):
>>
>>
>> Please we're talking Python here not C so strip out those unneeded
> parenthesis.
>
> Not so sure I agree. Python doesn't need them, but I often find code easier
> to parse when the scope of binary operators is made clear via parens. The
> precedence order of python is just one more thing to recall (and is
> fighting for space in my head with precedence orders for a bunch of formal
> languages). A bit of extra typing can save a second or cognitive lag each
> time the line is read.
>
> Best,
>
> Brian vdB
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
I think we'll have to agree to disagree. I just hate having to use my
Mk I eyeballs parsing something that I regard as noise.
--
Cheers.
Mark Lawrence.
More information about the Tutor
mailing list