Look at the error message:
File "/tmp/submission/20220826/20/52/hackerrank-fb3d12eb5f6eb2b1d99475a9a96b5a15/code/Solution.py", line 29, in <module>
print(max(sums))
TypeError: 'int' object is not callable
So, the problem is with
print
,
max
, or
sums
.
You aren't calling anything on
sums
so we can ignore that.
print
is a function: if we add a line above that which says
print("Hello World")
It works and we get no error on that.
So it has to be a problem with
max
.
Look at the rest of your code, and we find this:
max = -99
So you are defining
max
as an integer value. That overrides the "normal" definition of max as a function, and gives you a problem.
Remove the line, and it'll work: 56 is printed.
You should expect to get syntax errors every day, probably many times a day while you are coding - we all do regardless of how much experience we have! Sometimes, we misspell a variable, or a keyword; sometimes we forget to close a string or a code block. Sometimes the cat walks over your keyboard and types something really weird. Sometimes we just forget how many parameters a method call needs.
We all make mistakes.
And because we all do it, we all have to fix syntax errors - and it's a lot quicker to learn how and fix them yourself than to wait for someone else to fix them for you! So invest a little time in learning how to read error messages, and how to interpret your code as written in the light of what the compiler is telling you is wrong - it really is trying to be helpful!
So read this:
How to Write Code to Solve a Problem, A Beginner's Guide Part 2: Syntax Errors[
^] - it should help you next time you get a compilation error!