diff --git a/projects/016-reverse-lookup/python/main.py b/projects/016-reverse-lookup/python/main.py index e69de29b..6e4077f1 100644 --- a/projects/016-reverse-lookup/python/main.py +++ b/projects/016-reverse-lookup/python/main.py @@ -0,0 +1,22 @@ +def reverseLookup(u_dict, u_value): + key_list = [] + for key in u_dict: + if u_dict[key] == u_value: + key_list.append(key) + + return key_list + + +model_car = { + 'Fiesta' : 'Ford', + 'Mustang': 'Ford', + 'Puma': 'Ford', + 'Kuga': 'Ford', + 'Punto': 'Fiat', + 'Cinquecento': 'Fiat', + 'Panda': 'Fiat', + '206': 'Peugeot' +} + +print(reverseLookup(model_car, 'Fiat')) +