Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python L39 US Game 1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the purpose of the line:

这句代码的目的是什么?

t.ht()

a)

To set the turtle’s heading to zero

将turtle 的航向设置为零

b)

To hide the turtle

为了藏好 turtle

c)

To highlight the turtle
为了让turtle更突出

2.

In the code, what does .penup() do to the turtle?
在代码中,.penup() 对 turtle 做了什么?

a)

stop drawing line

b)

draw more line

3.

Which method reads the 50_States.csv file into a DataFrame?

哪种方法可以将 50_States.csv 文件读取到 DataFrame 中?

a)

pandas.open_csv()

b)

pandas.read_csv()

c)

pandas.load()

d)

pandas.read_file()

4.

填写空白处,将图像添加为海龟形状:

Fill in the blank to add the image as the turtle shape:

screen.__________(image)

a)
addshape
b)

addimage

c)

add_image

d)

add_shape

5.

What does this line return?
这行代码返回什么? state = data[data.state == user_answer]

a)

The DataFrame row(s) where state equals user_answer


DataFrame 中 state 等于 user_answer 的行

b)

The x and y coordinates of the guessed state


guessed state的 x 和 y 坐标

c)

A list of all states except user_answer


除 user_answer 之外的所有states 列表。

d)

An error because state is undefined

因为 state 未定义而导致错误。

6.

If the CSV file is named "50_states.csv" but your code says "50_States.csv", what will happen and why?
如果 CSV 文件名为“50_states.csv”,但你的代码却写成“50_States.csv”,会发生什么情况?为什么?

a)

The code will run successfully without any issues.
代码将成功运行,不会出现任何问题。

b)

The code will fail to find the file due to case sensitivity.
由于区分大小写,代码将无法找到该文件。

c)

The file will be found but will return empty data.

文件会被找到,但会返回空数据。

d)

The code will throw a syntax error unrelated to the file name. 这段代码会抛出一个与文件名无关的语法错误。

7.

Why do we use .item() when getting the x and y coordinates?
为什么在获取 x 和 y 坐标时要使用 .item()?

a)

We use .item() to format the coordinates for display.
我们使用 .item() 来格式化坐标以便显示。

b)

We use .item() to retrieve the actual x and y coordinate values from a data structure.
我们使用 .item() 从数据结构中检测实际的 x 和 y 坐标值。

c)

We use .item() to convert coordinates to strings.


我们使用 .item() 将坐标转换为字符串。

d)

We use .item() to calculate the distance between points.

我们使用 .item() 来计算点之间的距离。

8.

what the meaning of addshape?

a)

Add a custom image or shape for turtle

添加turtle 的自定义图像或形状

b)

Move turtle without drawing a line
移动turtle 而不画线

c)

Display text at the turtle’s location
在turtle 所在位置显示文本

d)

Hide the turtle
藏好 turtle

9.

Complete the code to check if the guessed state is correct: 完成代码以检查猜测的状态是否正确:

if user_answer ____ all_state:

guessed_num += 1

a)
in
b)

is

c)

not

10.

Fill in the missing part so the turtle writes at the state’s position:
填入缺失部分,使turtle 能够在指定位置书写: t.​ _____ (state.​x.item(), state.Y.item())

a)
X
b)
goto
c)
Y
d)
move