python how to create list of dictionaries code example
Example 1: How are Python dictionaries different from Python lists?
list1 = ["a", "b" ,"c"] # a bunch of things
dictionary1 = {"a":1, "b":2, "c":3} # like a list but each part of it has an associated extra bit
Example 2: how to use dictionaries in python
student_data = {
"name":"inderpaal",
"age":21,
"course":['Bsc', 'Computer Science']
}
#the keys are the left hand side and the values are the right hand side
#to print data you do print(name_of_dictionary['key_name'])
print(student_data['name']) # will print 'inderpaal'
print(student_data['age']) # will print 21
print(student_data['course'])[0]
#this will print 'Bsc' since that field is an array and array[0] is 'Bsc'