0

Hello I am trying to figure out of a number is triangular so I started writing my logical train of thought and ran into a little problem with my code I get an error that states "TypeError: 'int' object is not callable" any help is most appreciated. here is what my code looks like that is causing this issue:

x = int(input("Please enter an int: "))
i = x(x+1)/2
l = []
l.append(i)
print(i)
serge
  • 1
  • 3

1 Answers1

1

You have to use the * operator for multiplication.

x = int(input("Please enter an int: "))
i = x*(x+1)/2 # << fixed here
l = []
l.append(i)
print(i)
blackbrandt
  • 2,010
  • 1
  • 15
  • 32