![]() |
Python Turtle Help - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Python Turtle Help (/thread-15672.html) |
Python Turtle Help - patrick_oneal_4 - Jan-27-2019 I need to make three connected shapes. I keep recieving this error: File "<stdin>", line 5 velez.color("MediumOrchid") SyntaxError: invalid syntax under curveLF File "<stdin>", line 1, in <module> NameError: name 'curveLF' is not defined The following is my code. Any ideas? import turtle wn = turtle.Screen() wn.bgcolor("plum") belen = turtle.Turtle() belen.color("MediumPurple") belen.pensize(5) def curveRF(): for i in range(200): belen.right(1) belen.forward(1) belen.left(140) belen.forward(111.75) curveRF() belen.left(120) curveRF() belen.forward(111.75) ruby = turtle.Turtle() def curveL(): for i in range(200): ruby.left(1) ruby.forward(1) ruby.color("MediumVioletRed") ruby.pensize(5) ruby.speed(0) ruby.left(-140) ruby.forward(111.75) curveL() ruby.left(-120) curveL() ruby.forward(111.75) velez = turtle.Turtle() def curveLF(): for i in range(200): velez.left(1) velez.forward(1) velez.color("MediumOrchid") velez.pensize(5) velez.speed(0) velez.right(50) velez.forward(111.75) curveLF() velez.left(-120) curveLF() velez.forward(111.75) wn.exitonclick() RE: Python Turtle Help - ichabod801 - Jan-27-2019 The first error says it's for line 5, but that's line 38. I ran your code and it worked fine. RE: Python Turtle Help - patrick_oneal_4 - Jan-27-2019 What program do you use? RE: Python Turtle Help - ichabod801 - Jan-27-2019 The one you posted. Is there another one? RE: Python Turtle Help - patrick_oneal_4 - Jan-27-2019 Sorry, I mean, what compiler do you use? RE: Python Turtle Help - ichabod801 - Jan-27-2019 Uh, there are no compilers in Python. I ran it in Python version 3.6.3 on Windows. I just did another test with Python version 2.7.14. Again, no problems running the code, assuming it is supposed to draw three heart shapes. |