LANGUAGE ยป PYTHON

Flow control

Condition โ€‹

python
if 3 < 4:
    pass
elif 3 > 4:
    pass
else
    pass

For loop โ€‹

python
for value in my_list:
    print(value)

for index, value in enumerate(my_list):
    print(index, value)

for _ in range(10):  # If iterator is unnecessary
    pass

for elem1, elem2 in zip(my_list1, my_list2):
    print(elem1, elem2)

While loop โ€‹

python
while var1 < var2:
    pass
else
    # Only if while condition became false
    pass
## Result of break