python how to use dictionaries code example
Example 1: how to use dictionaries in python
student_data = {
"name":"inderpaal",
"age":21,
"course":['Bsc', 'Computer Science']
}
print(student_data['name'])
print(student_data['age'])
print(student_data['course'])[0]
Example 2: dicts python
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
x = thisdict["model"]
print(x)
---------------------------------------------------------------------------
Mustang
Example 3: how to create a dictionary in python
thisdict = {
"key1" : "value1"
"key2" : "value2"
"key3" : "value3"
"key4" : "value4"
}