I have the following code
num1 = 10 someBoolValue = True
I need to set the value of num1 to 20 if someBoolV
num1
20
someBoolV
You can do it this way.
try: a = [i for i in [20] if False][0] except IndexError: print("Do what ever you want here")
You can solve your problem this way but, using 'try/except block' is not the best practice for python.