Python Tutorial: Dictionary in Python

Опубликовано: 27 Август 2021
на канале: 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()}


На этой странице сайта вы можете посмотреть видео онлайн Python Tutorial: Dictionary in Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь GeeksByte 27 Август 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 113 раз и оно понравилось 5 зрителям. Приятного просмотра!