Is there a short way to do this:
if flag == False: flag = True I feel like it should be only a few letters.
I'm also curious about how other languages tackle this condition-assignment. Thank you.
Edit
If flag is True it needs to stay True therefore I can't use flag = not flag.
flat = True is indeed a one-line solution but since the statement is inside a loop I'm not sure if reassigning flat = True every time is good practice.
flag = True?flagwas previously eitherFalseorTrue. Also, comparing toFalsewith==is pretty much always either unnecessary or wrong.)flag = not flag...at least I think that's what your asking forflag = True.