You are working at a car dealership and store the car data in a dictionary:
car = {
'brand': 'BMW',
'year': 2018,
'color': 'red'
}
Your program needs to take the key as input and output the corresponding value.
Sample Input
year
Sample Output
2018
car = {
'brand':'BMW',
'year': 2018,
'color': 'red',
'mileage': 15000
}
p = input()
y = p.lower()
if y == 'brand':
print (car['brand'])
elif y == 'year':
print (car['year'])
elif y == 'color':
print (car['color'])
elif y == 'mileage':
print (car['mileage'])
else:
print ('error')