Finances X70568


Statement
 

pdf   zip

html

Design the function finanzas(dhab) which, given a dictionary dhab, that associates the ID of each inhabitant with a list containing their name, city, age and income, returns a dictionary that associates each city with the total income of its inhabitants.

Sample session
>>> dic = {'33950850R': ['ALFONSO JOSE CATALA  CAJA', 'VIC', 33, 43522],
...        '36517855Z': ['HUGO BERROJO  CASITAS', 'MATARO', 33, 54376],
...        '37383015U': ['GERARD COLOMER  LAZARO', 'MATARO', 42, 48453],
...        '46770197K': ['FRANCESC XAVIER BARBERAN  ZAVALA', 'MANRESA', 27,63931],
...        '43436441N': ['MIGUEL BARCELO  ALARCÓN', 'GRANOLLERS', 36, 77932],
...        '40446681H': ['JOSE MIGUEL GIL  QUER', 'BARCELONA', 47, 45280],
...        '52405618J': ['VERONICA BORRUEL  SANAHUJA', 'MATARO', 37, 62910],
...        '33947100B': ['ROBERTO JAVIER CASAJOANA  PIÑOL', 'GRANOLLERS', 37, 58152],
...        '38145526G': ['JAIME GARRIGA  DEL RIO', 'VIC', 28, 70356],
...        '33946091A': ['LAURA MOLINA  RAMOS', 'BARCELONA', 37, 50724]}
>>> df = finanzas(dic)
>>> if df != {'VIC': 113878, 'MANRESA': 63931, 'MATARO': 165739,
...           'GRANOLLERS': 136084, 'BARCELONA': 96004}:
...     print(df)
Information
Author
InfBesos
Language
English
Translator
Original language
Spanish
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python