How to Use Generator Expressions in Python Dictionaries

Imagine the following scenario:

You work in law enforcement for the US Department of Labor, finding companies that pay below minimum wage so you can initiate further investigations. Like hungry dogs on the back of a meat truck, your Fair Labor Standards Act (FLSA) officers are already waiting for the list of companies that violated the minimum wage law. Can you give it to them?

Here’s the code from my new book “Python One-Liners“:

companies = {‘CoolCompany’ : {‘Alice’ : 33, ‘Bob’ : 28, ‘Frank’ : 29},
‘CheapCompany’ : {‘Ann’ : 4, ‘Lee’ : 9, ‘Chrisi’ : 7},
‘SosoCompany’ : {‘Esther’ :

Continue reading the original article