Python for Everybody - The Tuples Collection

Tell us what’s happening:

Python 3.6 has changed handling

the result of the following code is a traceback error

instead of answer (b), could you please tell me what has been changed in simple terms, ignoring class definition issues if possible.

 d=dict()
>>> d['quincy']=1
>>> d['beau'] = 5
>>> d['kris']=9
>>> for (k,i) in d.items:
...     print(k, i)
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'builtin_function_or_method' object is not iterable

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0

Challenge Information:

Python for Everybody - The Tuples Collection

you need to call items, note that in the code snippet in the question it is called, It will not give an error if you call it

Missing the parentheses at the end of items()

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.