users = {'sam': 20, 'mike': 30, 'joe': 40}
# return users where the ave is greater than 20
users_over_20 = {k: v for k, v in users.items() if v > 20}
# print users over 20
print(users_over_20)
# output {'mike': 30, 'joe': 40}
# dict comprehension we use same logic, with a difference of key:value pair
# {key:value for i in list}
fruits = ["apple", "banana", "cherry"]
print({f: len(f) for f in fruits})
#output
{'apple': 5, 'banana': 6, 'cherry': 6}