Skip to content

Instantly share code, notes, and snippets.

@leveled
Last active February 22, 2021 00:38
Show Gist options
  • Save leveled/a21115d3a512c6d8d97749906bf35efa to your computer and use it in GitHub Desktop.
Save leveled/a21115d3a512c6d8d97749906bf35efa to your computer and use it in GitHub Desktop.
using the zip function python
fahrenheit = {'t1':-30, 't2':-20, 't3':-10, 't4':0}
#Get the corresponding `celsius` values
celsius = list(map(lambda x: (float(5)/9)*(x-32), fahrenheit.values()))
#Create the `celsius` dictionary
celsius_dict = dict(zip(fahrenheit.keys(), celsius))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment