wayground logo

Lembar Kerja Gratis yang Dapat Dicetak

Ukuran huruf

S
M
L
XL
Lembar kerja

Python L39 US Game 1

Total soal: 12

Worksheet time: 11mins

Nama
Kelas
Tanggal
1.

What is the purpose of the line: t.ht()

a)

To set the turtle’s heading to zero

b)

To hide the turtle

c)

To halt the turtle’s movement

d)

To highlight the turtle

2.

In the code, what does .penup() do to the turtle?

4 lines
3.

Which method reads the 50_States.csv file into a 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. (a)   (image)

5.

What does this line return? state = data[data.state == user_answer]

a)

The DataFrame row(s) where state equals user_answer

b)

The x and y coordinates of the guessed state

c)

A list of all states except user_answer

d)

An error because state is undefined

6.

If the CSV file is named "50_states.csv" but your code says "50_States.csv", what will happen and why?

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?

a)
We use .item() to format the coordinates for display.
b)
We use .item() to retrieve the actual x and y coordinate values from a data structure.
c)
We use .item() to convert coordinates to strings.
d)
We use .item() to calculate the distance between points.
8.

Write the missing code to make the turtle write the guessed state name: t.goto(state.x.item(), state.y.item()) t. (a)   (user_answer)

9.

What will happen if the player guesses the same state twice?

a)

It will be added again to guessed_states

b)

It will overwrite the previous label

c)

It will cause an error

10.

Match each turtle/pandas function to its correct purpose:

a)

Add a custom image or shape for turtle

1.

addshape()

b)

Move turtle without drawing a line

2.

.penup()

c)

Display text at the turtle’s location

3.

.write()

d)

Hide the turtle

4.

.ht()

11.

Complete the code to check if the guessed state is correct: if user_answer ____ all_state: guessed_states.append(user_answer)

a)
in
b)

is

c)

not

12.

Fill in the missing part so the turtle writes at the state’s position: t.​ (a)   (state.​ (b)   .item(), state.Y.item())

Pilihlah dari kata-kata di bawah ini
X
goto
Y
move