+ 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
4 Answers
+ 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'.
+ 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.
+ 1
thank uâș
0
u mean the second parameter is used to print a scentence..?