<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Combining Multiple Mappings into a Single Mapping
Problem
You have multiple dictionaries or mappings that you want to logically combine into a single mapping to perform certain operations, such as looking up values or checking for the existence of keys.
Solution
An easy way to do this is to use the ChainMap class from the collections module.
Step1:  Discussion
A ChainMap takes multiple mappings and makes them logically appear as one. However, the mappings are not literally merged together. 
If there are duplicate keys, the values from the first mapping get used. Thus, the entry c['z'] in the example would always refer to the value in dictionary a, not the value in dictionary b.
Operations that mutate the mapping always affect the first mapping listed.
Step2:  As an alternative to ChainMap, you might consider merging dictionaries together using the update() method.
Step3:  This works, but it requires you to make a completely separate dictionary object (or destructively alter one of the existing dictionaries). Also, if any of the original diction‐ aries mutate, the changes don’t get reflected in the merged dictionary.
Step4:  A ChainMap uses the original dictionaries, so it doesn’t have this behavior.
<ASSISTANT_TASK:>
Python Code:
a = {'x': 1, 'z': 3 }
b = {'y': 2, 'z': 4 }    
from collections import ChainMap
c = ChainMap(a,b)
print(c['x']) # Outputs 1 (from a) 
print(c['y']) # Outputs 2 (from b) 
print(c['z']) # Outputs 3 (from a)
Explanation: Combining Multiple Mappings into a Single Mapping
Problem
You have multiple dictionaries or mappings that you want to logically combine into a single mapping to perform certain operations, such as looking up values or checking for the existence of keys.
Solution
An easy way to do this is to use the ChainMap class from the collections module.
End of explanation
c['z'] = 10
c['w'] = 40
del c['x']
print(a)
print(b)
del c['y']
Explanation: Discussion
A ChainMap takes multiple mappings and makes them logically appear as one. However, the mappings are not literally merged together. 
If there are duplicate keys, the values from the first mapping get used. Thus, the entry c['z'] in the example would always refer to the value in dictionary a, not the value in dictionary b.
Operations that mutate the mapping always affect the first mapping listed.
End of explanation
a = {'x': 1, 'z': 3 }
b = {'y': 2, 'z': 4 }
merged = dict(b)
merged.update(a)
print(merged['x'])
print(merged['y'])
print(merged['z'])
Explanation: As an alternative to ChainMap, you might consider merging dictionaries together using the update() method.
End of explanation
a['x'] = 13
merged['x']
Explanation: This works, but it requires you to make a completely separate dictionary object (or destructively alter one of the existing dictionaries). Also, if any of the original diction‐ aries mutate, the changes don’t get reflected in the merged dictionary.
End of explanation
a = {'x': 1, 'z': 3 }
b = {'y': 2, 'z': 4 }
merged = ChainMap(a, b)
print(merged['x'])
a['x'] = 42
print(merged['x']) # Notice change to merged dicts
print(a['x'])
Explanation: A ChainMap uses the original dictionaries, so it doesn’t have this behavior.
End of explanation
<END_TASK>