8.3. Dictionary Comprehension#

dict1={
    'A':1,
    'B':2,
    'C':3
}
dict1
{'A': 1, 'B': 2, 'C': 3}
{x:y for x,y in dict1.items()}   # Note: here x:y is returned instead of x,y because of format of dict we need
{'A': 1, 'B': 2, 'C': 3}
{x:y*100 for x,y in dict1.items()}
{'A': 100, 'B': 200, 'C': 300}
{x.lower():y*100 for x,y in dict1.items()}
{'a': 100, 'b': 200, 'c': 300}