Toggle

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Oct 9 03:25:46 CEST 2014


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?

-- 
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