Problem with while loop (Q.3 of assignment)

n = -2
while n <= 0:

    print("Please enter a natural number i.e. whole number greater than zero ")
    x=input('Enter a natural number : ')
    n= int(x)
    print(n)


print('The average of first ',n,'natural numbers = ',(n(n+1))/2*n  )    

here error is in last line saying that ‘int’ object is not callable

Your last line is like this

print('The average of first ',n,'natural numbers = ',(n(n+1))/2*n  ) 

In the above formula for average, you have to have n*(n+1) but you just did n(n+1).

Although it is good that you use while loop to take the appropriate input number

But according to the question you needed to use while loop to get the average of n natural number and not use a formula to find the average of n natural numbers.