Control Flow
if and else are used to provide conditional control flow.
a = None
if foo == 'bar':
a = 1
else:
a = 2
for loops are used for iterating through a list or dictionary. In the case of lists, for will unpack into a single value. In the case of dicts, for will unpack into two values representing the key and value of every row in the dictionary.
# list iteration.
sum = 0
for a in [1,2,3]:
sum = sum + a
# sum's final value is 6.
# dict iteration.
sum = ""
for key, value in {"a": 1, "b": 2, "c": 3}:
sum = sum + key + str(value)
# sum's final value is 'a1b2c3'.