[Python tutorial] a turtle is actually cool (1. Move)

Time:2022-4-28

Preparation before class:
Win7 ~ win10, MacOS, > = computers with Ubuntu 16.04
Python idle above Python 3.1.1

1、 Tortoise?
Tortoise is a drawing module, which can be imported in Python as follows:

import turtle

1. Forward function
This function causes the turtle to draw a linestraight lineX degree

import turtle
turtle.forward(100)

2. Left function
This function makes turtlesTurn leftX degree

import turtle
turtle.left(100)

3. Right function
This function makes turtlesTurn rightX degree

import turtle
turtle.right(x)

2、 Production procedure

Import # import module
for x in range(100):
    turtle. Forward (x) # forward x units
    turtle. Left (90) # turn left 90 degrees

Draw a spiral square with exactly 100 lines.