Duplicate key 'I' in dictionary
30 return texto
31
32
33elementos_eletro = {'F': 3.98, "O": 3.44, "Cl": 3.16, 'N': 3.04, 'Br': 2.96, 'I': 2.66, 'S': 2.58, 'Ac': 0.7, "La": 0.79, 'Sr': 0.82, 'Ce': 0.89, 'Th': 0.89, 'Na': 0.93, 'Y': 0.95, 34 'Li': 0.98, 'K': 0.82, 'Pr': 1.1, 'Pa': 1.1, 'Nd': 1.12, 'Pm': 1.13, 'Sm': 1.14,
35 'Gd': 1.17, "Dy": 1.2, 'Zr': 1.22, 'Er': 1.22, 'Tm': 1.23, 'Yb': 1.24, 'Lu': 1.25,
36 'Ta': 1.27, 'Cm': 1.28, 'W': 1.3, 'U': 1.3, 'Bk': 1.3, 'Cf': 1.3, 'Es': 1.3,
Duplicate key 'S' in dictionary
30 return texto
31
32
33elementos_eletro = {'F': 3.98, "O": 3.44, "Cl": 3.16, 'N': 3.04, 'Br': 2.96, 'I': 2.66, 'S': 2.58, 'Ac': 0.7, "La": 0.79, 'Sr': 0.82, 'Ce': 0.89, 'Th': 0.89, 'Na': 0.93, 'Y': 0.95, 34 'Li': 0.98, 'K': 0.82, 'Pr': 1.1, 'Pa': 1.1, 'Nd': 1.12, 'Pm': 1.13, 'Sm': 1.14,
35 'Gd': 1.17, "Dy": 1.2, 'Zr': 1.22, 'Er': 1.22, 'Tm': 1.23, 'Yb': 1.24, 'Lu': 1.25,
36 'Ta': 1.27, 'Cm': 1.28, 'W': 1.3, 'U': 1.3, 'Bk': 1.3, 'Cf': 1.3, 'Es': 1.3,
Description
This dictionary expression binds the same key multiple times. This may lead to unintentional behaviour as the key will always map the last value provided to it. It is recommended to have unique keys.
Bad practice
Here, the key random
is provided twice.
DICT = {
"some": "some",
"random": "random",
"dict": "dict",
"values": "values",
"random": "different",
}
Recommended
All keys should be unique.
DICT = {
"some": "some",
"dict": "dict",
"values": "values",
"random": "different",
}