Словарь Получите все ключи
hh = {"a":3, "b":4, "c":5}
print(hh.keys())
# dict_keys(['a', 'b', 'c'])
print(list(hh.keys()))
# ['a', 'b', 'c']
Sore Sloth
hh = {"a":3, "b":4, "c":5}
print(hh.keys())
# dict_keys(['a', 'b', 'c'])
print(list(hh.keys()))
# ['a', 'b', 'c']
# To get all the keys of a dictionary as a list, see below
newdict = {1:0, 2:0, 3:0}
list(newdict)
# Output:
# [1, 2, 3]
#python 3
for k,v in dict.items():
print(k, v)
#dictionariies
programming = {
"Bugs": "These are the places of code which dose not let your program run successfully"
,"Functions":"This is a block in which you put a peice of code"
,"Shell":"This is a place where the code is exicuted"
}
print(programming["Bugs"])
print(programming["Shell"])
for eliment in programming:
print(eliments)