Control 5 - Tabla Periodica de los Elementos

TI2 - Sección 3

Usted cuenta con el diccionario "simbolos" que contiene los elementos quimicos, y una tupla asociada que contiene el número de atomos y la descripción del elemento.


In [1]:
simbolos = {"AC" : (89, "Actinio"),  "AG" : (47, "Plata"),  "AL" : (13, "Aluminio"),  "AM" : (95, "Americio"), 
"AR" : (18, "Argón"),  "AS" : (33, "Arsénico"),  "AT" : (85, "Astato"),  "AU" : (79, "Oro"), 
"B" : (5, "Boro"),  "BA" : (56, "Bario"),  "BE" : (4, "Berilio"),  "BH" : (107, "Bohrio"), 
"BI" : (83, "Bismuto"),  "BK" : (97, "Berkelio"),  "BR" : (35, "Bromo"),  "C" : (6, "Carbono"), 
"CA" : (20, "Calcio"),  "CD" : (48, "Cadmio"),  "CE" : (58, "Cerio"),  "CF" : (98, "Californio"), 
"CL" : (17, "Cloro"),  "CM" : (96, "Curio"),  "CN" : (112, "Copernicio"),  "CO" : (27, "Cobalto"), 
"CR" : (24, "Cromo"),  "CS" : (55, "Cesio"),  "CU" : (29, "Cobre"),  "DB" : (105, "Dubnio"), 
"DS" : (110, "Darmstadtio"),  "DY" : (66, "Disprosio"),  "ER" : (68, "Erbio"),  "ES" : (99, "Einstenio"), 
"EU" : (63, "Europio"),  "F" : (9, "Flúor"),  "FE" : (26, "Hierro"),  "FL" : (114, "Flerovio"), 
"FM" : (100, "Fermio"),  "FR" : (87, "Francio"),  "GA" : (31, "Galio"),  "GD" : (64, "Gadolinio"), 
"GE" : (32, "Germanio"),  "H" : (1, "Hidrógeno"),  "HE" : (2, "Helio"),  "HF" : (72, "Hafnio"), 
"HG" : (80, "Mercurio"),  "HO" : (67, "Holmio"),  "HS" : (108, "Hassio"),  "I" : (53, "Yodo"), 
"IN" : (49, "Indio"),  "IR" : (77, "Iridio"),  "K" : (19, "Potasio"),  "KR" : (36, "Kriptón"), 
"LA" : (57, "Lantano"),  "LI" : (3, "Litio"),  "LR" : (103, "Lawrencio"),  "LU" : (71, "Lutecio"), 
"LV" : (116, "Livermorio"),  "MC" : (115, "Moscovio"),  "MD" : (101, "Mendelevio"),  "MG" : (12, "Magnesio"), 
"MN" : (25, "Manganeso"),  "MO" : (42, "Molibdeno"),  "MT" : (109, "Meitnerio"),  "N" : (7, "Nitrógeno"), 
"NA" : (11, "Sodio"),  "NB" : (41, "Niobio"),  "ND" : (60, "Neodimio"),  "NE" : (10, "Neón"), 
"NH" : (113, "Nihonio"),  "NI" : (28, "Niquel"),  "NO" : (102, "Nobelio"),  "NP" : (93, "Neptunio"), 
"O" : (8, "Oxígeno"),  "OG" : (118, "Oganessón"),  "OS" : (76, "Osmio"),  "P" : (15, "Fósforo"), 
"PA" : (91, "Protactinio"),  "PB" : (82, "Plomo"),  "PD" : (46, "Paladio"),  "PM" : (61, "Prometio"), 
"PO" : (84, "Polonio"),  "PR" : (59, "Praseodimio"),  "PT" : (78, "Platino"),  "PU" : (94, "Plutonio"), 
"RA" : (88, "Radio"),  "RB" : (37, "Rubidio"),  "RE" : (75, "Renio"),  "RF" : (104, "Rutherfordio"), 
"RG" : (111, "Roentgenio"),  "RH" : (45, "Rodio"),  "RN" : (86, "Radón"),  "RU" : (44, "Rutenio"), 
"S" : (16, "Azufre"),  "SB" : (51, "Antimonio"),  "SC" : (21, "Escandio"),  "SE" : (34, "Selenio"), 
"SG" : (106, "Seaborgio"),  "SI" : (14, "Silicio"),  "SM" : (62, "Samario"),  "SN" : (50, "Estaño"), 
"SR" : (38, "Estroncio"),  "TA" : (73, "Tántalo"),  "TB" : (65, "Terbio"),  "TC" : (43, "Tecnecio"), 
"TE" : (52, "Teluro"),  "TH" : (90, "Torio"),  "TI" : (22, "Titanio"),  "TL" : (81, "Talio"), 
"TM" : (69, "Tulio"),  "TS" : (117, "Tennesso"),  "U" : (92, "Uranio"),  "V" : (23, "Vanadio"), 
"W" : (74, "Wolframio"),  "XE" : (54, "Xenón"),  "Y" : (39, "Itrio"),  "YB" : (70, "Iterbio"), 
"ZN" : (30, "Cinc"),  "ZR" : (40, "Circonio")}

Usted debe completar la rutina "encuentra_mayor", en que retorne cual es el elemento de mayor cantidad de atomos, donde la sigla esta incluida dentro del texto ingresado como parametro de la funcion. En el caso que no haya ningún elemento dentro del texto, debe retornar 0.


In [14]:
def encuentra_mayor(str, dict):
    simbolo_mayor = ""
    atomos_mayor = 0
    for i in dict.keys():
        if i in str:
            if dict[i][0] > atomos_mayor:
                atomos_mayor = dict[i][0]
                simbolo_mayor = i
    if atomos_mayor == 0:
        return 0
    return dict[simbolo_mayor][1]

Atención: Ingrese su apellido, en caso de tener acentos omitalos (sin acentos)


In [12]:
apellido = input('Ingrese su apellido: ')


Ingrese su apellido: bizama

In [15]:
encuentra_mayor(apellido.upper(), simbolos)


Out[15]:
'Americio'

In [ ]:


In [ ]: