Repeating Code Using Loops

2.

for value in half_lives:
    print(value, end=' ')

4. a.

alkaline_earth_metals = [[4, 9.012], [12, 24.305],
                         [20, 40.078], [38, 87.62],
                         [56, 137.327], [88, 226]]
b.
for inner_list in alkaline_earth_metals:
    print(inner_list[0])
    print(inner_list[1])
c.
number_and_weight = []
for inner_list in alkaline_earth_metals:
    number_and_weight.append(inner_list[0])
    number_and_weight.append(inner_list[1])

7.

total = 0
for population in country_populations:
    total += population

9.

for number in range(33, 50):
    print(number)

11.

sum = 0
count = 0
for number in range(2,23):
    sum += number
    count += 1

average = sum / count

13.

for width in range(1, 8):
    print('T' * width)

15.

width = 1
while width < 8:
    print('T' * width)
    width += 1

width = 1
while width < 8:
    print(' ' * (7 - width), 'T' * width, sep='')
    width += 1