Off-Platform Project: TypeError: 'int' object is not callable

Hello!

I am attempting to play around with writing math expressions in python, but I keep coming up with the TypeError: 'int' object is not callable.

Here is my code below, please let me know if you can see what might be the issue!

import math 

def score_function(n,k):
    k_score = (n - ((n-2*k*math.sqrt(n/k) + k + 1)/2)**2 - n)/(n(n-1))
    #returns an interger
    return k_score

def check_function():
    n = 11
    for k in range(1, n+1):
        print(n, k, score_function(n, k))


check_function()
   

To a mathematician, that means multiply. To the python interpreter, that means call the function n with the argument n - 1.

2 Likes

ahhh! Amazing. Thank you for your help :slight_smile:

2 Likes

You’re welcome! Happy coding!

2 Likes