Aug-31-2019, 02:24 PM
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')
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')