Typing code in IDLE is NOT the same thing as typing code in a file but it does offer the ability to create, edit and save Python programs as .py files.
Notice that the color of βimportβ is orange. This is called syntax highlighting which IDLE does to show that it recognizes certain Python commands.
# draws bottom of house
niki.right(90)
niki.forward(128)
niki.left(90)
niki.forward(128)
niki.left(90)
niki.forward(128)
niki.left(90)
niki.forward(128)
# draws roof of house
niki.right(135)
niki.forward(90)
niki.right(90)
niki.forward(90)
For windows operating system users: to associate .py files with IDLE, right click on the file and select βPropertiesβ from the context menu and then the βChangeβ button where it says βOpen with..β
Subsection12.2.3Level 3 - Type turtle program into IDLE
In this last part, you will type your turtle program directly into the IDLE console, one line at a time. This is a very different experience because IDLE interprets and executes each line after you hit βreturnβ.
In the IDLE console, type import turtle then press βreturnβ. Python imported the turtle module and is now ready to accept the next command (see the >>>).
Next type wn = turtle.Screen() then press βreturnβ. Python creates and displays an empty turtle canvas and again the prompt >>> indicates that IDLE is ready for the next command.
Now type niki = turtle.Turtle() and press βreturnβ. Python creates a turtle and displays it at the x,y coordinate (0,0) which is the center of the canvas. Again the >>> prompt appears.
Notice that text entered into IDLE canβt be edited after the line of code has been executed when you press βreturnβ. Test this out by trying to change a line of code that you entered.
Letβs say you were writing a program and you didnβt remember how Python handles mathematical order of operations (for example, β4 + 8/2β). How is IDLE useful in this situation as compared to just typing the statement directly into your program file?