0

How does the get function work with a dictionary?

I’ve tested some things out and I can’t find any pattern or logic. Pls help

16th Oct 2021, 12:14 AM
StrWrsBoi
StrWrsBoi - avatar
2 Respostas
+ 2
Hey, I suspect you're referring to dict.get(). If that is the case, the following articles might help you to better understand it: https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ref_dictionary_get.asp https://www.programiz.com/python-programming/methods/dictionary/get
16th Oct 2021, 12:18 AM
Devnull
Devnull - avatar
0
details={name:"jasy",position:"developer",experience:3} result=details.get(name,"unknown") print(result) GET method is used to look for a value of a key named "name", it will return "unknown" if a key and its value not in a dictionary
16th Oct 2021, 9:42 PM
Jasy Fabiano
Jasy Fabiano - avatar