Work with python dictionary

Dictionaries are used to store data in key-value pairs. So, it helps to easily retrive data for given context. Here we will breifly discuss dictionary in python code. Basic sturcture is as follows {key : value}. So, it is very easy to use.

list = [1,2,3,4]
data = {1:1, 2:2, 3:3, 4:4}
# There is another example
data = {"name" : "Faizan",
       "class" : "AI"}

So, it helps to work with dictionaries very easily.

Published by Faizan Amin

I am a web and android developer

Leave a comment

Design a site like this with WordPress.com
Get started