Now, three of my friends have gathered together to start studying Python alone.
We all wrote the same code last night, but only one person
ttype error 'int' objyect is not callable <
It came out and stopped.
My friend said, "Isn't it a runtime error?" In that case, I think the display says runtime.
I can't reproduce it on my PC and it's hard to determine the cause, but is there a "runtime error" hypothesis?(I searched and found that Runtime error occurs when multiple accesses occur at the same time.)
I would appreciate it if you could let me know if anyone knows anything.
(I'd like to check it out at the next study meeting...)
Code Used
data=[56,45,83,67,59,41,77]
print(sum(data))
print(max(data))
print(min(data))
For example, if you declare a new variable called sum
, the built-in function sum
becomes unavailable and you get an error similar to the one in the questionnaire.This is because function calls are made to newly defined variables instead of sum
of the built-in function.
>>data=[56,45,83,67,59,41,77]
>>sum=sum(data)
>>print(sum)
428
>>print(sum(data))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
While trying various things on the interpreter, the built-in function may have been overwritten as described above.
As a supplement, remember Python's built-in exception RuntimeError
separately from the so-called Runtime Exception.As the error message states, this is TypeError
, not RuntimeError
.On the other hand, this error is not a syntax error or static type check error, but a runtime error.
© 2024 OneMinuteCode. All rights reserved.