Oct-24-2020, 01:56 PM
(This post was last modified: Oct-24-2020, 09:37 PM by deanhystad.)
#this x = 2 #is no different than this if 4 > 3: x = 2 #or this a = 3 if a % 2: x = 2You can define variables anywhere you want in Python. Your example didn't work because you don't know the difference between set equal to "=" and is equal to "=="
a=0 b=1 if a == 0: c = b else: c = a