Help, what's wrong in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Help, what's wrong in this code?

import turtle my_turtle = turtle.Turtle def square(angle,leght): my_turtle.forward(leght) my_turtle.left(angle) my_turtle.forward(leght) my_turtle.left(angle) my_turtle.forward(leght) my_turtle.left(angle) my_turtle.forward(leght) square(90,200)

4th Jun 2017, 9:12 AM
►► Ferontwix ◄◄
►► Ferontwix ◄◄ - avatar
3 Answers
+ 5
As tell by @Álvaro, you need indent all code lines defining your square() custom function... but anyway, if you try to run this code in Sololearn code playground, you will not succeed, as module Turtle is not available/runnable in this context ( Python interpreter is running on server side, in a kind of emulator limited to text console mode and not compatible with any graphic mode ^^ )
4th Jun 2017, 11:17 AM
visph
visph - avatar
+ 4
indentation turtle.Turtle -> turtle.Turtle()
4th Jun 2017, 9:36 AM
Álvaro
+ 2
thanks
4th Jun 2017, 9:43 AM
►► Ferontwix ◄◄
►► Ferontwix ◄◄ - avatar