xxxxxxxxxx
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
# the keys are like variables in dictionary which saves a value
x = car.keys()
print(x)
xxxxxxxxxx
# Dictionary with three keys
Dictionary1 = {'A': 'Geeks', 'B': 'For', 'C': 'Geeks'}
# Printing keys of dictionary
print(Dictionary1.keys())
xxxxxxxxxx
my_dict = {"apple": 4, "banana": 2, "orange": 5, "mango": 3}
keys = list(my_dict.keys())
print(keys)
xxxxxxxxxx
'''we define a dictionary store which tells us the inventory name and
the amount of inventory saved in stock'''
store = {"Salt":230,"Flour":540,"Oil":150,"Sugar":210,"Juice":100}
'''the keys function returns us a list of the set keys so we can use them
to our will'''
keys = store.keys()
print(keys)
xxxxxxxxxx
# keys in python
List_of_Students = {"Jim" : "Roll-32"+","+ "Priority-First",
"Yeasin": "Roll-33"+","+ "Priority-2nd",}
print(List_of_Students["Yeasin"])
xxxxxxxxxx
# Creating a sample dictionary
person = {
'name': 'John',
'age': 30,
'gender': 'Male'
}
# Accessing dictionary keys
keys = person.keys()
# Printing the keys
print(keys)