pythonpython-2.7turtle-graphics

Python Turtle compare colour


my problem is I wanted to compare the Turtle colour but apparently there is a failure:

>>> turtle.color("green")

>>> turtle.color()

('green', 'green')

>>> turtle.color==("green")

False

>>> turtle.color==('green', 'green')

False

I already tried really many options of syntax but there was always the same output. I hope you can help me out here


Solution

  • You need to call the color() function:

    turtle.color() == ('green', 'green')
    

    otherwise you are trying to compare the function object itself.