Ukuran huruf
Lembar kerjaPython L39 US Game 1
Total soal: 12
Worksheet time: 11mins
What is the purpose of the line: t.ht()
To set the turtle’s heading to zero
To hide the turtle
To halt the turtle’s movement
To highlight the turtle
In the code, what does .penup() do to the turtle?
Which method reads the 50_States.csv file into a DataFrame?
pandas.open_csv()
pandas.read_csv()
pandas.load()
pandas.read_file()
Fill in the blank to add the image as the turtle shape: screen. (a) (image)
What does this line return? state = data[data.state == user_answer]
The DataFrame row(s) where state equals user_answer
The x and y coordinates of the guessed state
A list of all states except user_answer
An error because state is undefined
If the CSV file is named "50_states.csv" but your code says "50_States.csv", what will happen and why?
Why do we use .item() when getting the x and y coordinates?
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)
What will happen if the player guesses the same state twice?
It will be added again to guessed_states
It will overwrite the previous label
It will cause an error
Match each turtle/pandas function to its correct purpose:
Add a custom image or shape for turtle
addshape()
Move turtle without drawing a line
.penup()
Display text at the turtle’s location
.write()
Hide the turtle
.ht()
Complete the code to check if the guessed state is correct: if user_answer ____ all_state: guessed_states.append(user_answer)
is
not
Fill in the missing part so the turtle writes at the state’s position: t. (a) (state. (b) .item(), state.Y.item())
