Python123 Quiz 2: Python basic graphics rendering (week 2) accompanying explanation

1 which option turtle can not reference library and then use the correct setup () function?

A、from turtle import*

B、import setup from turtle

C、import turtle as t

D、import turtle

 The correct answer: B 

import only three ways to use,

To turtle library, for example: import turtle from turtle import setup or from turtle import * import turtle as t (where t is an alias, you can replace other names)

 

2 About turtle library, describe which option is wrong?

A, turtle Library is an intuitive and fun graphics rendering library

B, turtle library was first successfully applied to the LOGO programming language

C, turtle origin of the coordinate system in the upper left corner of the screen by default

D, turtle drawing system at the right level as an absolute azimuth of 0 degree

 The correct answer: C 

Turtle origin of the coordinate system in the middle of the default screen

 

3, which option is the absolute zero degree angle in the direction of turtle graphics coordinate system?

A, front-left of the canvas

B, just above the canvas

C, canvas just to the right

D, just below the canvas

 The correct answer: C 

Like this coordinate system, the coordinate system of the absolute angle of 0 degree direction is a right side

 

4. Which of the following is the result of the implementation of the code?

turtle.circle(-90,90)

a, drawn with a radius of 90 pixels arc, circle center of the canvas

B, drawn with a radius of 90 pixels of the arc, the center left of the current traveling in the hatchlings

C, a draw radius of 90 pixel full circular

D, a radius of 90 pixels drawn arc, in the center of the right side of the current traveling hatchlings

 The correct answer: D 

Circle (x, y) represents the radius to the length x, y is the angle, the left side of the current direction x shown as the center circle. Wherein x and y may be negative, the corresponding negated.

 

5, About turtle graphics library functions, which describe the options is wrong?

A, effect turtle.pensize (size) function is to change the size of the pixel width of the stroke

B, effect turtle.fd (distance) function is the distance from the forward traveling direction to the current small turtles

C, effect turtle.seth (to_angle) function is provided as the current traveling direction of the small turtles to_angle, to_angle integer value angle

Effect of D, turtle.circle (radius, extent = None) function is to draw an ellipse, extent optional parameters

 The correct answer: D 

Circle () function can not draw the ellipse.

 

6, About brush control function turtle library description which option is wrong?

A, turtle.penup () alias has turtle.pu (), turtle.up ()

B, turtle.width () and turtle.pensize () can be used to set the size of the brush

Action C, turtle.colormode () is a schematic set of RGB color pen

D, turtle.pendown () action is a pen down, and moves the pen to draw a dot

 The correct answer: D 

turtle.pendown () just put down the brush, does not draw anything.

 

7, which option does not change the direction turtle pen?

A、left()

B、seth()

C、bk()

D、right()

 The correct answer: C 

bk () can only back, but do not change direction, "back" is not "turn."

 

8 which listed reserved words option enables the loop executes a set of statements?

A、for和in

B、while和def

C、range()

D、if和else

 The correct answer: A 

Circular correlation is reserved words: for..in and while, but def for defining functions not related.

 

9 which option to use turtle draw a semicircle library?

A、turtle.circle(100, -180)

B、turtle.fd(100)

C、turtle.circle(100)

D、turtle.circle(100, 90)

 The correct answer: A 

Usage circle (x, y) function, rendering semicircular, the second argument y is an odd multiple of 180.

 

10, which option described turtle.done () is correct?

A, turtle.done () on the final code, is a necessary requirement turtle drawing, the drawing showing the completion of

B, turtle.done () to stop brushed, but the form is not drawing off

C, turtle.done () is used to draw the hide turtle pen, generally on the code of the last

D, turtle.done () to pause brushed, the user can continue to draw response

 The correct answer: B 

The last increase in the recommended turtle.done each turtle graphics ().

 

turtle octagon draw

 ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‪‬

description

Use turtle library, draw a octagon.

Note: This is an automatic reviewers topic, please add "Programming Templates" hyphens content.

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

 

 

turtle graphics rendering star anise

 ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‪‬

description

Use turtle library, draw an octagonal shape.

Note: This is an automatic reviewers topic, please add "Programming Templates" hyphens content.

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

 

 

Published 22 original articles · won praise 17 · views 1131

Guess you like

Origin blog.csdn.net/qq_45803800/article/details/104602426