Python Tutorial: Dictionary in Python

Publicado em: 27 Agosto 2021
no 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()}


Nesta página do site você pode assistir ao vídeo on-line Python Tutorial: Dictionary in Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário GeeksByte 27 Agosto 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 113 vezes e gostou 5 espectadores. Boa visualização!