I’m trying to use the max function in Python 3,6:
print('Maximum is:', max(1, 3, 2, 5, 4))
And the result is
File "E:/ProgramyRobione/untitled1.py", line 2, in <module>
print('Maximum is:', max(1, 3, 2, 5, 4))
TypeError: 'int' object is not callable
I’m using Spyder and that line is all that code should do.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
This is a bit of an iPython headshot that comes with Spyder. I’ve fallen foul of this when copy/pasting random bits of code from SO to test only to find really odd behaviour several days later – variables defined in the iPython console will also be in the script’s global namespace indefinitely.
There’s two things you can do:
- A hard restart of the Kernel (
ctrl+.) - Follow up on this feature request thread where it’s now possible to clear the namespace automatically every time you run a script.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0