Python3 Dictionary Examples

1. Simple Example To Show How To Create Dictionary In Python3.

student={'name':'test','age':22,'fee':17.6}
print(student)
print(student['age'])
 

2. Simple Example To Show The Operations On Dictionary In Python3.

student={'name':'test','age':22,'fee':17.6}
print(student)
del student['name']
print(student)
student.clear()
print(student)
 

3. Simple Example To Show How To Get Data From Dictionary In Python3.

student={'name':'test','age':22,'fee':17.6}
print(student.keys())
print(student.values())
print(student.get('age'))
 

4. Simple Example To Show How To Iterate Data From Dictionary In Python3.

student={'name':'test','age':22,'fee':17.6}

for i in student.keys():
    print(i,"  ",student.get(i))
 

5. Simple Example To Show How Update Data In Dictionary Using Python3.

student={'name':'test','age':22,'fee':17.6}
print(student)
student['name']='testing'
print(student)
student['address']='Bangalore'
print(student)