d = dict.fromkeys((i**2 for i in range(1,5)),1)
print(d)
print(5 in d) #quiker way to check the key
# comprehension
items = [('a', 1), ('b',2), ('e',3)]
my_dict = {key: value for key,value in items}
print(my_dict)
transformed_dict = {k.upper(): v*2 for k, v in my_dict.items()}
print(transformed_dict)
my_dict = {x: x**2 for x in range(5)}
print(my_dict)
nested_dict = {x: {y: x*y for y in range(1, 4)} for x in range(1,4)}
print(nested_dict)
# tuples in Python are immutable, you cannot directly change the 'e' value inside items.
# However, because items is a list of tuples, you can replace the entire tuple by rebuilding the dictionary.
original_dict = {key if key != 'e' else 'c': value for key, value in items}
print(original_dict)