dict() method gives TypeError: ‘dict’ object is not callable

  python-3.x

I am wondering what is wrong with this code on jupyter notebook

thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
mydict = dict(thisdict)
print(mydict)

I get this error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-49-57523ce125a7> in <module>
      5   "year": 1964
      6 }
----> 7 mydict = dict(thisdict)
      8 print(mydict)

TypeError: 'dict' object is not callable

the strange thing is that this code works fine from command line and interpreter

Source: Python-3x Questions

LEAVE A COMMENT