Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
the second value is returned only if the first value is not among the keys. it is sort of a replacement for the searched value if it is not present. if you have dictionary dict={1:2,3:4} dict.get(3,'not there') would return 4,since that is the value associated with key 3, but dict.get(5,'not there') would return 'not there', since there is no value associated with 5
7th Jul 2016, 9:44 PM
RedAnt
RedAnt - avatar