Toggle

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Oct 9 05:02:31 CEST 2014


On 09/10/2014 02:25, Mark Lawrence wrote:
> On 09/10/2014 01:11, Seymore4Head wrote:
>> I want to toggle between color="Red" and color="Blue"
>> Here is one:
>>      if color == "Red":
>>          color = "Blue"
>>      else:
>>          color = "Red"
>> Here is two:
>> if x = "True" color = "Red"
>> else:
>> color="Blue"
>> x= not x
>>
>> Others?
>>
>
> Here http://stackoverflow.com/questions/8381735/toggle-a-value-in-python
> but why couldn't you search in the first place?
>

When I first read this I was extremely jealous of the originator but 
having used it umpteen times I'm still extremely jealous of the 
originator!!!  Why doesn't my mind work like his? :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list