Python Tutorial
What is a Dictionary In Python?

Hello, Guy’s Welcome To The Another Python Article, In This Article We Learn What is a Dictionary In Python?

What is a Dictionary?

Dictionary is Nothing But a Key and Value Pair Of Data. Means That a Key That Indicates The Value Of The Data. In Other Words, A Key Or a String That Indicate The Extra Data That is Know As Dictionary.

For Example:-

If there is a Date Of Birth Dictionary. So If You Enter The Name Of The Person So His/He Birth Date Will Show. So This Is The Best Example Of Dictionary In Python.

How To Create Dictionary In Python?

You Just Create A Variable And Assien Its Curly Bracket. Inside The Curly Bracket, You Write The Name Of Key and The Use : This Sign and After This, You Write The Value Of That Particular Key.

Syntax:-

x = {“raj”:“29 Feb”, “rajul”:“15 july”, “ashu_tosh_mishra”:“21 nov”}

As We See Very Clearly That “raj” is a Key And “29 Feb” is a Value Of That Particular Key.

Result:-

If We Call The Key “raj” so we Get The Output “29 Feb”. Let’s Check It.

Input:- print(x.raj)

Output:- 29 Feb

Thanks For Reading This Article.