How to draw a smiley face using python? First we need to download and install the python program, and then download and install the turtle package. After all the preparations are done, we can start our next painting work.
#1. Find the python IDLE tool on our own computer.
2. Then open IDLE, create a new file, and name it test1.py.
Related recommendations: "Python Video Tutorial"
3. Then we start importing the turtle library and then edit the code.
from turtle import * penup() goto(0,-200) pendown() circle(200) penup() goto(-100,50) pendown() begin_fill() circle(17.5) end_fill() penup() goto(100,50) pendown() begin_fill() circle(17.5) end_fill() penup() goto(0,50) pendown() circle(-70,steps=3) penup() goto(-150,-70) pendown() right(15) goto(0,-170) goto(150,-70) hideturtle()
4.F5 run the code and view the renderings.
The above is the detailed content of How to draw a smiley face using python. For more information, please follow other related articles on the PHP Chinese website!