+ 2

Guys ...plz help me I cannot under stan this code??

you will find my quistion in the code https://code.sololearn.com/cuT6elO067Uy/?ref=app

22nd May 2018, 5:09 PM
Omar
Omar - avatar
4 Respostas
+ 7
Omar o There is no need for the comma at the end. If you run print(pairs) it disappears. The dict_name.get() method has 2 parameters: the key name and an optional message that is returned if there is no corresponding value, instead of the default message 'None'.
22nd May 2018, 5:24 PM
David Ashton
David Ashton - avatar
+ 6
Yes. In your example code print(pairs.get(7)) print(pairs.get(12345, "not in dictionary")) The first line outputs 'None' because there is no key called 7. The second line outputs 'not in dictionary' because there is no key called 12345 and you have a default value, i.e. the message.
22nd May 2018, 5:39 PM
David Ashton
David Ashton - avatar
+ 1
thank u☺
22nd May 2018, 8:45 PM
Omar
Omar - avatar
0
u mean the second parameter is used to print a scentence..?
22nd May 2018, 5:26 PM
Omar
Omar - avatar