Update dict.py

Write with a list comprehension.