Python Tutorial: Dictionary in Python

Pubblicato il: 27 agosto 2021
sul canale di: 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()}


In questa pagina del sito puoi guardare il video online Python Tutorial: Dictionary in Python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato GeeksByte 27 agosto 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 113 volte e gli è piaciuto 5 spettatori. Buona visione!