Convert Temperatures with map()

Easy ⏱ 8 min 82% acceptance ★★★★★ 4.6
Write to_fahrenheit(celsius_list) that converts every Celsius reading to Fahrenheit (F = C × 9/5 + 32) using map with a lambda, returning a list.

Examples

Example 1
Input
to_fahrenheit([0, 100])
Output
[32.0, 212.0]
Explanation

Freezing and boiling points of water.

Constraints

  • Use map + lambda, not a comprehension.
  • Return a list, not a map object.

Topics

Lambda & Functionalmap

Companies

AccentureIBM

Hints

Hint 1

map returns a lazy iterator — wrap it in list().

Hint 2

lambda c: c * 9 / 5 + 32.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.