Spring Deals - hours only!Up to 70% off on all courses and bundles.-Close
Iterating over a list
Modifying lists
Working with multiple lists
11. Creating new lists based on existing ones


Good job! Now that we know how to modify lists, let's move on to working with multiple lists at the same time.

The easiest case is when we create a new list based on an existing list. The example below creates a new list that contains some winter temperatures in Fahrenheit (fahrenheit_temperatures) based on temperatures in Celsius (celsius_temperatures).

celsius_temperatures = [-10, -7.78, -5, -2.78, 0, 1.67]
fahrenheit_temperatures = []
for time in celsius_temperatures:
  fahrenheit_temperatures.append(round(time * 1.8 + 32))


[14, 18, 23, 27, 32, 35]

Before the for loop, we created an empty list named fahrenheit_temperatures. Within the loop, we iterated over the elements of the old list, processed each element, and appended it to a new list.


Martha's expenses are currently expressed in USD. Create a new list named monthly_spendings_eur that contains the same expenditures converted into euros. Use the exchange rate of 1 USD = 0.88 EUR.

Round the EUR values to two decimal places using:

round(value, 2)

Then, print monthly_spendings_eur list.

Stuck? Here's a hint!

Create an empty list named monthly_spendings_eur before the for loop. Inside the loop, append new elements based on monthly_spendings elements.