21
Aug

# Python Programming Tutorials for Beginners in Windows – Dictionary Data type tutorial

hello friends in this video I will
explain what is the dictionary that is one of the data types of Python how we
can use the dictionary datatype so in our previous videos we have seen for the
basics of what is dictionary and how we can declare a key value pair and we have
seen how we are declaring the list sets a row so let’s see now how we can define
a dictionary and access those values or update those values and delete those
values first how we can create a dictionary like a list of something so
let’s give like our D or D toe so we used a curly brace and you have to
assign some keys okay dictionary is working on basis of certain keys and
their corresponding values so let’s assign book as the key and its
corresponding values Python so this is one key value so now the key is book and
the value is Python so one is over so again I am declaring next key so that is
price and its values say hundred so we have completed two key value pairs in a
dictionary that is dictum so now if you will return the value of nikto you can
see the value is the price is hundred and the book is Python so now how you
will return the values so normally how we will access the values using the
index but in dictionary you have to access by using its key so that is dicto
of you can access the price so that is its key in the two of price because unless the
coats so getting the value 100 so in this way we can access the values in the
dictionaries then apart from this direct initialization how we can create so like
you can create in this way so let’s say like a new dicto and we have a function
called dictum in this way you can create a new dictionary so now a dictionary has
been created with our new dictum okay so if you see like what is there in dictum
so there is nothing because we didn’t give any values it so let’s start
assigning the values so new dictum so let’s give the first key so the key is
first and we are assigning the values –is online so next let’s assign the
next value new dicto to its second key so now the key is second and its
corresponding value is classes okay so now we have given these values so if you
see that dictionary now new dictum you are having the values so now you can
access by using its keys that is a new dicto of first so what you are getting
online so in this way you can access the values so now we are having two
dictionaries that is one is new dicto and another newness dictum now I would
like to add some values or add some few more key value pairs in this
dictionaries how you can add so in this way you can add it so like dicto of XE
third this is equal to let’s give a spider
again so now if you see the value for dicto may having the three values so in
this way we can add the values in the dictionary in a key value pair by going
on and in case if you want to update so let’s see third is having the same
values Python so I want to change it to online so how you can change it so that
is dicto of the key third and I would like to change it to online so that a
key phrase in this way the value will be changed so you see here the value is
changed so in this way you can update the values also and if you want to
delete any particular value say here I want to delete the book from this or
dito so how you can delete it so Dell it dicto of book so I have deleted it so
now what is the value is present in the dicto so it is price and third so the
book is deleted from the dictionary so in this way we can declare are the keys
and their corresponding values and we can add more key and values and we can
access them we can update them and if you don’t want the values in the
dictionary you can delete them so we can use this dictionary data type in our
python programming for most of our needs I hope you guys understand the syntax
and usage in this program. please like my video please subscribe my
channel for more videos thank you