Python Tutorial: Dictionary in Python

Publicado el: 27 agosto 2021
en el canal de: GeeksByte
113
5

#region Notes
"""
Mutable
ordered Sequence
Heterogenous items
Key-Value pair
Accessed by Key
Key should be Unique
"""
#endregion

data={
1: "one",
'2': [2, "Two"],
3 : {
3.1 : True,
3.2 : (1,2,3)
}
}
#region crud
data[2]=2
print(data)
print(data.get(2,"NA"))
data[2]="Two"
print(data.get(2,"NA"))
data.pop(1)
data.popitem()
print(data)
#endregion

for key, value in data.items():
if key == 3:
print("Nested dictionary")
else:
print(f"{key} = {value}")

{print("Nested dictionary") if key == 3 else print(f"{key} = {value}") for key, value in data.items()}


En esta página del sitio puede ver el video en línea Python Tutorial: Dictionary in Python de Duración hora minuto segunda en buena calidad , que subió el usuario GeeksByte 27 agosto 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 113 veces y le gustó 5 a los espectadores. Disfruta viendo!