Python-Quiz 2 (mooc)

Which option cannot correctly reference the turtle library and use the setup () function? import
setup from turtle
import turtle as t
from turtle import *
import turtle
correct answer A
import only has three methods of use, taking the turtle library as an example:

import turtle

from turtle import setup 或 from turtle import *

import turtle as t (where t is an alias, you can change other names)

2
Regarding the turtle library, which option is wrong? turtle
drawing system to
The origin of the 0-degree turtle coordinate system with absolute orientation on the right side of the screen is the default. The
turtle library was successfully used in the LOGO programming language. The
turtle library is an intuitive and interesting graphics drawing function library. The
correct answer is B.
The origin of the turtle coordinate system defaults to the window. In the middle of the body

3
Which option is the absolute 0 degree direction of the angular coordinate system in the turtle drawing?
front-left of the canvas
Directly below the
canvas Directly to the right of the
canvas Directly above the canvas The
correct answer C
coordinate system is similar to this, the absolute 0 degree direction of the angular coordinate system is to the right

4
Which option is the execution result of the following code?

turtle.circle(-90,90)

draw
a radius A 90-pixel arc with the center of the circle at the center of the canvas

Draw an arc with a radius of 90 pixels, with the center of the circle to the left of the turtle's current travel

Draw an arc with a radius of 90 pixels, with the center of the circle to the right of the turtle's current travel

Draw a full circle with a radius of 90 pixels

The correct answer C
circle (x, y) means that the length of x is the radius, y is the angle, and the x on the left side of the current direction is the center of the circle. Both x and y can be negative numbers, correspondingly inverted.

5
Regarding the drawing function of the turtle library, which option is wrong? turtle.seth
( The function of to_angle) function is to set the current traveling direction of the turtle to_angle, to_angle is the integer value of the angle.
turtle.circle (radius, extent = None) The function of the function is to draw an ellipse, the extent parameter is optional
turtle.fd (distance) The function of the function is to advance the distance to the current direction of the turtle
. The function of the turtle.pensize (size) function is to change the width of the brush to size pixels. The
correct answer B
circle () function can not draw an ellipse.

6
Regarding the brush control function of the turtle library, which option is wrong? turtle.pendown
( ) The function is to drop the brush and move the brush to draw a point.
Turtle.width () and turtle.pensize () can be used to set the brush size.
Turtle.colormode () is used to set the brush RGB color representation mode.
Turtle.penup () The alias is turtle.pu (), turtle.up () The
correct answer A
turtle.pendown () just put down the pen, and does not draw anything.

7
Which option cannot change the running direction of the turtle brush? BK
()
left ()
seth ()
right () The
correct answer A
bk () can only go back, but does not change the direction, "backward" is not "turn".

8
Which reserved words listed can realize the cyclic execution of a group of statements? for
and in
the while And def
range ()
if and else
correct answer A
cycle related reserved words are: for ... in and while, but def is used to define the function, it is not related.

9
Which option can use the turtle library to draw a semicircle? turtle.fd
( 100)
turtle.circle (100, -180)
turtle.circle (100, 90)
turtle.circle (100)
correct answer B
circle (x, y) function usage, draw a semicircle, the second parameter y is an odd number of 180 Times.

10
Which option describes turtle.done () correctly? turtle.done
( ) Is used to hide the turtle drawing brush. It is generally placed at the end of the code.
Turtle.done () is placed at the end of the code. It is a necessary requirement for turtle drawing. It means that drawing is completed.
Turtle.done () is used to stop the brush drawing, but the drawing form is not closed.
turtle.done () is used to pause the drawing of the brush, and you can continue drawing after the user responds. The
correct answer C
recommends adding turtle.done () at the end of each turtle drawing.


turtle octagon draw
Description
Using the turtle library, draw an octagon.

Note: This is an automatic review question, please add the horizontal line in the "Programming Template", the horizontal line is not retained.

import turtle as t
t.pensize(2)
for i in range(8):
    t.fd(100)
    t.left(45)

turtle octagonal drawing

Description
Use the turtle library to draw an octagonal figure.

Note: This is an automatic review question, please add the horizontal line in the "Programming Template", the horizontal line is not retained.

import turtle as t
t.pensize(2)
for i in range(8):
    t.fd(150)
    t.left(135)
Published 29 original articles · liked 0 · visits 480

Guess you like

Origin blog.csdn.net/qq_43771959/article/details/105568399