Jan-07-2019, 01:45 PM
(Jan-07-2019, 01:40 PM)python_user_n Wrote: But in the returned dictionary I found an item with a key of the type 'int' that have a value of 'int'.
Maybe it's .setdefault() method behavior(predicted?). Thanks.
once again - show us your full code. we cannot guess what your list that you pass to the function looks like. what you get from the function and what is expected output?
(Jan-07-2019, 01:40 PM)perfringo Wrote: Shouldn't this function give NameError as d is not defined?
I guess the line
d = dict()
is in the doc-string by mistake :-)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs