Python Forum

Full Version: [split] TypeError: 'int' object is not callable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am new to programming and i have a threat that is Turple is not callable how can i solve it. Also, i cant figure out how to color my polygon using the if statment.
here is my code:

import turtle

turtle.Screen()

alex=turtle.Turtle()


n=int(input('please enter the number of polygon sides: '))
length=float(input('Give me the length of the side in pixels: '))
alex=turtle.Turtle()

alex.pencolor('red')
alex.pencolor('green')
i=n
for i in range(n):

alex.forward(length)
alex.left(360/n)



if ( i%2==0):
alex.pencolor('green')
print('i love you')

else:
alex.pencolor('red')
print('i hate you')
Welcome to the forum. Before you post again, please take time to read forum rules/help pages.
Don't hijack other user's threads. Start new thread for your own question.

Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.

Please, post the entire traceback that you get. We need to see that whole thing. Do not just give us the last line.
Take a time to read What to include in a post