how to add a key and a value to a dictionary in python
diction = {'key':'value'}#Adding a dictionary called diction.
print(diction)
diction['newkey']='newvalue'#Adding the newkey key to diction with its value.
print(diction)
#output: {'key':'value','newkey':'newvalue'}
a_dictionary = {} #creates a blank dictionary
#variables created outside of dictionary
name = "Geronimo" #this will become a key to access the value
age = 34 #This becomes the value assigned to the key
a_dictionary[name] = bid #this adds the key and the value
# plz suscribe to my youtube channel -->
# https://www.youtube.com/channel/UC-sfqidn2fKZslHWnm5qe-A
#dictionary
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"])
#Adding items to dictionary
#Firtly get the access to the dictionary
programming["Loops"] = "This is a action of doing something repeatedly"
print(programming["Loops"])