how do dictionaries work in python 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: dictionary in python
d = {'key1':'value1','key2':'value2'}
print(d)
l=d.keys
print(l)
b=d.values
print(b)
Example 3: Python Dictionaries
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict["brand"])
Example 4: dictionary in python
Dict = {"name": 'Izhaan', "salary": 1234, "age": 23}
print("\nDictionary with the use of string Keys: ")
print(Dict)