On 2020-03-09 14:16, David Mertz wrote:
This isn't a terrible use of the walrus operator either.
if blue_20 := (color==BLUE and count==20) or red_5 := (color==RED
and count%5==0)
rotate_the_wheel() # Common to the two sub-conditions
if blue_20: # First sub-condition
This isn't a terrible use of the walrus operator either.
if blue_20 := (color==BLUE and count==20) or red_5 := (color==RED and
count%5==0)
rotate_the_wheel() # Common to the two sub-conditions
if blue_20: # First sub-condition
set_signal()
if red_5: # Second sub-condition
On Sun, 8 Mar 2020 at 15:02, Shrinivas Kulkarni wrote:
>
> Hello Everyone
>
> While writing python code, I frequently come across the need to do
> certain tasks based on combined conditions.
>
> Much of the task for all the sub-conditions are common but some are
> specific to one or more of these