Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python3 

2 

3"""Solution to chapter 7, exercise 32: flipped_dict""" 

4 

5 

6def flipped_dict(a_dict): 

7 """Gets a dict as an argument. 

8Returns a dict as output. The output dict's keys 

9are the input dict's values, and vice versa. 

10""" 

11 return {value: key 

12 for key, value in a_dict.items()}