Home > database >  Python sprout new painting snake out of the problem bosses, please advise
Python sprout new painting snake out of the problem bosses, please advise

Time:09-17

Humble of new online consult
The first figure is required, however, the second picture is my generation  will appear the wrong

CodePudding user response:

Why SQL plate has a python, and the middle of the tip in your code that from the turtle. The color (" pink ") why doesn't the indentation to the upper drawSnake method

CodePudding user response:

The import turtle


Def drawSnake (rad, Angle, len, neckrad) :
Mycolor=[" black ", "red", "red", "blue", "yellow"]
Yocolor="yellow", "green", "yellow", "red", "red"]
For I in range (len) :
Turtle. Pencolor (mycolor [I])
Turtle. Circle (rad, Angle)
Turtle. Pencolor (yocolor [I])
Turtle. Circle (- rad, Angle)
Turtle. Pencolor (" green ")
Turtle. Circle (rad, Angle/2)
Turtle. Pencolor (" yellow ")
Turtle. Fd (rad)
Turtle. Pencolor (" red ")
Turtle. Circle (neckrad + 1, 180)
Turtle. Pencolor (" green ")
Turtle. Fd (rad * 2/3)


Def the main () :
Turtle. Setup (1300, 800, 0, 0)
Pythonsize=30
Turtle. Pensize (pythonsize)
Turtle. Seth (40)
DrawSnake (40, 80, 5, pythonsize/2)


The main ()

CodePudding user response:

The
refer to the reply of IT white dots on the second floor:
import turtle


Def drawSnake (rad, Angle, len, neckrad) :
Mycolor=[" black ", "red", "red", "blue", "yellow"]
Yocolor="yellow", "green", "yellow", "red", "red"]
For I in range (len) :
Turtle. Pencolor (mycolor [I])
Turtle. Circle (rad, Angle)
Turtle. Pencolor (yocolor [I])
Turtle. Circle (- rad, Angle)
Turtle. Pencolor (" green ")
Turtle. Circle (rad, Angle/2)
Turtle. Pencolor (" yellow ")
Turtle. Fd (rad)
Turtle. Pencolor (" red ")
Turtle. Circle (neckrad + 1, 180)
Turtle. Pencolor (" green ")
Turtle. Fd (rad * 2/3)


Def the main () :
Turtle. Setup (1300, 800, 0, 0)
Pythonsize=30
Turtle. Pensize (pythonsize)
Turtle. Seth (40)
DrawSnake (40, 80, 5, pythonsize/2)


The main ()
refer to this