+ 53

TIP TO UNDERSTAND EASILY

Look at dictionaries just like a reference dictionary. The key is like the word and the value is the meaning. so, we could have our mini English dictionary >>> myEngDict = { 0: "The first entry of a decimal number system", 1: "The second number", 4: "The square of 2" } Now you might want to add the meaning of 2 because someone might not understand what 2 used in defining 4 is. So >>> myEngDict[2] = "The this number in the decimal number system" so our new dictionary says: >>> myEngDict { 2: "The this number in the decimal number system", 0: "The first entry of a decimal number system", 1: "The second number", 4: "The square of 2" } Suppose you want to make definition of 4 simpler. to make it easier: >>> myEngDict[4] = "The fifth entry in the decimal number system" That will edit the value for key 4. Now let a user use our dictionary: they want to know the meaning of 1 >>> myEngDict[1] "The second number", What if they look for a number we don't have? They will get a KeyError to show that that we don't have that word in our dictionary. so we can now understand that keys are the "words" in our dictionary and values are the "meanings" of those words. Comments, questions welcomed.

12th Sep 2016, 6:10 PM
Cornel
Cornel - avatar
14 ответов
+ 8
welcome.
13th Sep 2016, 9:24 AM
Cornel
Cornel - avatar
+ 7
Much appreciated. Very good examples. Thanks mate!
12th Sep 2016, 8:24 PM
Carlos Sacanell
Carlos Sacanell - avatar
+ 6
good,easy and helpful
20th Nov 2016, 7:51 AM
Faris Alhodali
Faris Alhodali - avatar
+ 5
Appreciate It Very Much... Thanks For Sharing
4th Nov 2016, 11:02 AM
Rasing Angi
Rasing Angi - avatar
+ 5
thx
6th Nov 2016, 6:42 AM
Brandon Lee
Brandon Lee - avatar
+ 4
Thank you. Great explanation. Have any more Tips. I would love to have them. sales@saveontoner.com
23rd Sep 2016, 3:35 PM
Dick
+ 4
Very good example. You could also use a phone book for example, where the number is linked to a name.
7th Nov 2016, 7:24 AM
Pratyaksh Sharma
Pratyaksh Sharma - avatar
+ 4
Good explanation
27th Dec 2016, 4:46 PM
Abdelaziz Mustapha
Abdelaziz Mustapha - avatar
+ 3
thanks
22nd Dec 2016, 2:24 PM
charif bamba
charif bamba - avatar
+ 1
thanks for a nice try to explain. indeed, dictionaries were implemented in Python to process human languages easily.
2nd Jan 2017, 6:10 AM
Semen Khlybov
Semen Khlybov - avatar
+ 1
Interesting
10th Jan 2017, 7:31 AM
Brain Power
Brain Power - avatar
+ 1
thanks,good example
11th Jan 2017, 11:06 AM
rasoul norouzi
rasoul norouzi - avatar
0
hi all
1st Jan 2017, 12:06 PM
Abdalmaged Karom
Abdalmaged Karom - avatar
0
Thnx
26th Aug 2017, 3:18 AM
Young Beom Kim
Young Beom  Kim - avatar