Iterating Over Multidimensional Lists in Python

Let's now learn how to iterate over multidimensional lists using loops. Let's say we have the following list:

pythonlst = [
  ['a', 'b', 'c'],
  ['d', 'e', 'f'],
  ['g', 'h', 'i']
]

Since this list is two-dimensional, to iterate over it you need two nested for loops:

pythonfor sub in lst:
  for el in sub:
    print(el)
Задание 1

Given a two-dimensional list:

pythonlst = [
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
]

Use a loop to print all the items in the list to the console.

Задание 2

Given a two-dimensional list:

pythonlst = [
  [2, 4, 6],
  [3, 5, 7],
  [9, 12, 15]
]

Use a loop to find the sum of the elements of this list.

Задание 3

Given a two-dimensional list:

pythonlst = [
  ['a', 'b', 'c'],
  ['d', 'e', 'f'],
  ['g', 'h', 'i']
]

Use a loop to merge all the elements of a list into a string.