I know how to make if statement inside for loop, but I don't know how to also add "else" there.
For example:
check_state = 1
for v in (v for v in range(0,10 +1, 1) if check_state == 1):
print v
Output: It will print from 0 to 10
And I want to add "else" statement there, something like this:
check_state = 0
for v in (v for v in range(0,10 +1, 1) if check_state == 1, else v for v in range(1)):
print v
Hoping for this output: prints 0
I don't know how to put it in correct syntax. Can somebody help?
Thank you!