-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex39.py
31 lines (25 loc) · 780 Bytes
/
ex39.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
cars = {
'sedans': ['accord', 'city'],
'trucks': ['f150', 'f250'],
'suvs': ['evoque', 'velar', 'sports'],
'hatchbacks': ['alto', 'wagonr', 'swift']
}
manufacturer = {'sedans': 'honda', 'trucks': 'ford', 'suvs': 'range rover'}
manufacturer['hatchbacks'] = 'maruti'
#print some manufacturers
print('-'*20)
print('hatchbacks are manufactured by', manufacturer['hatchbacks'])
print('sedans are manufactured by', manufacturer['sedans'])
#print cars by manufacturer
print('-'*20)
print('Types of sedans: ', cars['sedans'])
print('Types of suvs: ', cars['suvs'])
#print all car types
print('-'*20)
for cars, models in list(cars.items()):
print(f"{models} are {cars}")
print('-'*20)
try:
car = cars.get('luxury')
except:
print("Sorry no luxury type car")