WorksheetsPython Variables and Turtle Module Quiz
Total questions: 100
Worksheet time: 50mins
What is a variable in Python?
A variable is a place to store data that can be used and changed in a program.
A variable is a type of computer hardware.
A variable is a type of error in Python.
A variable is a command to print text.
Which Python code will draw a hexagon using the turtle module?
import turtle sides = 6 for i in range(0, sides): turtle.forward(50) turtle.right(360/sides)
import turtle sides = 4 for i in range(0, sides): turtle.forward(50) turtle.right(90)
import turtle sides = 3 for i in range(0, sides): turtle.forward(50) turtle.right(120)
import turtle sides = 8 for i in range(0, sides): turtle.forward(50) turtle.right(45)
What does the following code do? import turtle sides = 6 for i in range(0, sides): turtle.forward(50) turtle.right(360/sides)
Draws a hexagon (six-sided shape)
Draws a triangle (three-sided shape)
Draws a square (four-sided shape)
Draws a circle
Which of the following is a keyword related to Python programming?
variable
triangle
circle
octagon
If you want to change the number of sides in the shape drawn by the turtle, which part of the code should you modify?
The value assigned to the variable 'sides'
The value inside turtle.forward()
The word 'import'
The word 'turtle'
What is the main purpose of the Tracker Booklet mentioned in the learning material?
To use the learning objectives and track your progress
To write essays about computing
To draw pictures of computers
To record attendance in class
According to the learning objectives, what should you be able to do at the Bronze level?
Write Python code that will be output to the user
Understand what a variable is and use it to store data
Combine the use of outputs and variables for a given scenario
Create a website using HTML
At the start of the lesson, what are you expected to do in the lesson box?
RAG what you think you know so far
Write a summary of the previous lesson
Draw a diagram of a computer
List all the keywords for the lesson
Which of the following is a keyword mentioned in the learning material?
input
database
algorithm
encryption
What does the Gold learning objective require you to do?
Combine the use of outputs and variables for a given scenario
Write Python code that will be output to the user
Understand what a variable is and use it to store data
Draw a computer system
Why is it important to RAG what you think you know at the start of the lesson?
To reflect on your prior understanding and track your progress
To finish the lesson early
To avoid doing homework
To get a higher grade automatically
Which of the following is NOT listed as a keyword in the material?
encryption
output
variable
syntax
What does the Silver learning objective focus on?
Understanding what a variable is and using it to store data to output to the user
Writing a story about computers
Drawing a diagram of a computer
Learning about computer history
What is the purpose of the "Start" box in the lesson tracker?
To RAG what you think you know so far
To write your name
To draw a picture
To list your favorite subject
What is a variable in programming?
A value that can be changed and holds data
A type of computer hardware
A fixed value that never changes
A programming language
In the given Python code example, which word is used as a variable?
sides
import
turtle
forward
Which of the following is NOT a keyword related to the topic discussed in the material?
output
variable
syntax
hardware
Why are variables important in programming? (Choose the best answer)
They allow data to be stored and recalled when needed
They make the computer run faster
They are used to draw shapes only
They are only used in Python
Suppose you want to change the number of sides in the example code from 6 to 8. What should you do?
Change the value of the variable 'sides' to 8
Delete the variable 'sides'
Change 'import turtle' to 'import sides'
Remove the for loop
What value does the variable "sides" hold in the given Python code?
6
4
8
10
In the provided Python code, what is the purpose of the variable "sides"?
It stores the number of sides for the shape being drawn.
It stores the length of each side.
It stores the color of the shape.
It stores the name of the shape.
How is the variable "sides" used in the loop within the Python code?
It determines how many times the loop runs and helps calculate the angle for turning.
It sets the color of the turtle.
It changes the speed of the turtle.
It prints the value to the screen.
Why is it useful to use a variable like "sides" in a program that draws shapes?
It allows you to easily change the number of sides without rewriting the code.
It makes the program run faster.
It changes the color of the shape.
It makes the computer use less memory.
What is the first step to open Python using IDLE on a Windows computer?
Click on either the windows or magnifying glass symbols in the bottom left
Search for “IDLE”
Click on IDLE (Python)
Open the command prompt
Which of the following keywords is NOT listed as important for learning Python in the provided material?
output
syntax
loop
variable
After searching for "IDLE" and clicking on it, what should you expect to see?
A Python shell window with a prompt (>>>)
A web browser window
A file explorer window
A command prompt window
Why is it important to understand what a variable is when learning Python?
Because variables are used to store data to output to the user
Because variables make the code run faster
Because variables are only used for decoration
Because variables are not needed in Python
If you want to combine the use of outputs and variables for a given scenario in Python, which level of learning are you aiming for according to the material?
Gold
Bronze
Silver
Platinum
What is the name of the first window that appears when you open Python?
Editor
Shell
Console
Terminal
Where should you write your Python code?
In the shell window
In the editor window
In the command prompt
In the browser
What should you do to run your Python code after writing it in the editor?
Click Save
Select RUN and then RUN module
Close the editor
Type 'run' in the shell
Why is it important to know the difference between the shell and the editor in Python?
Because you can only save files in the shell
Because you write and run code in different windows
Because the shell is used for drawing shapes
Because the editor cannot display errors
Which Python turtle command is used to lift the pen up so you can move the turtle without drawing?
turtle.penup()
turtle.pendown()
turtle.right()
turtle.begin_fill()
What does the command turtle.fillcolor("Brown") do in Python turtle?
Changes the fill colour to brown (or other colour)
Changes the pen colour to red
Moves the turtle forward
Ends the filling sequence
Which command would you use to make the turtle turn left?
turtle.left()
turtle.right()
turtle.backward()
turtle.penup()
If you want to begin filling a shape with color in Python turtle, which command should you use?
turtle.begin_fill()
turtle.end_fill()
turtle.pendown()
turtle.penup()
What is the purpose of the variable 'sides' in the provided Python code snippet?
It stores the number of sides for the shape to be drawn
It stores the color of the pen
It stores the length of each side
It stores the fill color
In the code snippet, what does the loop 'for i in range(0, sides):' accomplish?
It repeats the drawing commands for each side of the shape
It changes the pen color each time
It fills the shape with color
It lifts the pen up after each side
Suppose you want to draw a square using the turtle module. What value should you assign to the variable 'sides'?
4
3
6
8
Why is spelling important when writing Python code, especially with turtle commands?
Incorrect spelling can cause errors and the code may not run
It makes the code look nicer
It helps the turtle move faster
It changes the color of the turtle
How would you change the pen color to blue using a turtle command?
turtle.pencolor("Blue")
turtle.fillcolor("Blue")
turtle.penup()
turtle.backward()
What shape will the turtle draw if the variable 'sides' is set to 6 in the provided code snippet?
Hexagon
Square
Triangle
Octagon
Which Python module is imported in the code example for drawing a rectangle?
turtle
math
random
os
What is the value assigned to the variable 'sides' in the rectangle drawing code?
4
2
3
6
In the provided code, what does the command 'turtle.forward(50)' do?
Moves the turtle forward by 50 units
Turns the turtle right by 50 degrees
Moves the turtle backward by 50 units
Draws a circle with radius 50
Why is the angle '360/sides' used in the turtle.right() function in the code?
To ensure the turtle turns the correct angle for each corner of the rectangle
To make the turtle move in a straight line
To change the color of the turtle
To increase the speed of the turtle
If you wanted to draw a triangle instead of a rectangle using the same code structure, what value should you assign to the variable 'sides'?
3
4
5
6
What is the purpose of using a variable like 'sides' in the code?
To store the number of sides of the shape being drawn
To change the color of the turtle
To print text to the screen
To import a module
How could you modify the code to make the rectangle longer on one side?
Change the value in turtle.forward(100) to a larger number
Change the value of 'sides' to 5
Remove the turtle.right() commands
Change the value in turtle.forward(50) to 0
Which of the following can variables represent in a computer program?
Only numbers
Only memory addresses
Numeric values, characters, character strings, or memory addresses
Only character strings
Why do variables allow you to write more flexible programs?
They make the program run faster
They allow you to write flexible programs instead of entering data directly into a program
They increase the size of the program
They make the program look better
What is one benefit of using variables in your program?
Your program can only be used once
Your program can be used for multiple purposes
Your program will use more memory
Your program will be harder to understand
Which of the following best describes a variable in programming?
A fixed value that never changes
A way to store and represent different types of data
A type of computer hardware
A programming error
Imagine you are writing a program that needs to store a user's name and age. What should you use to store this information?
Only print statements
Only comments
Variables
Loops
What does "user input" mean in computing?
Information provided by the user to the computer
Information displayed by the computer to the user
The process of saving files on a computer
The way a computer prints documents
Which of the following is a keyword related to user input in Python?
input
delete
copy
close
What is the purpose of a variable in Python?
To store data that can be used later in the program
To delete files from the computer
To print documents
To restart the computer
Which of the following best describes the "output" in a computer program?
The information shown to the user by the computer
The information typed by the user
The process of turning off the computer
The way a computer connects to the internet
If you want to combine the use of outputs and variables in a Python program, what should you do?
Store user input in a variable and then display it using output
Only use variables without any output
Only use output statements without variables
Ignore both variables and outputs
What is user input in a computer program?
When the program displays information to the user
When the user of the program enters data to be used by the program
When the program saves data to a file
When the program runs without any user interaction
Which of the following is an example of user input in a program?
The program printing "Hello, World!"
The user typing "Year 7" in response to "What year are you in?"
The program saving a file automatically
The computer turning on
Why is user input important in computer programs? (Choose the best answer)
It allows the program to display graphics
It lets the user enter data that the program can use
It makes the program run faster
It helps the computer use less memory
Imagine you are writing a Python program that asks the user for their name and then prints a greeting. Which of the following steps would you need to include?
Only print a greeting
Only ask for the user's name
Ask for the user's name and then use it to print a greeting
Do nothing
What does the following line of Python code do? sides = input("How many sides do you want your shape to have?")
It prints the number of sides of a shape
It creates a prompt asking the user for the number of sides and stores the answer in a variable
It draws a shape with the given number of sides
It calculates the area of a shape
What is the purpose of the variable "sides" in the code example?
To store the user's answer about the number of sides
To display the shape on the screen
To calculate the perimeter of the shape
To print a message to the user
After the user enters their answer, what does the program do next?
It ends the program
It stores the value in the variable "sides" and continues running
It prints the value to the screen and stops
It ignores the user's input
Why is it important to use variables like "sides" when writing a program that takes user input?
Variables help store and use the user's input later in the program
Variables make the program run faster
Variables are only used for decoration
Variables are not needed in any program
Suppose you want to ask the user for the color of their shape instead of the number of sides. Which line of code would you use?
color = input("What color do you want your shape to be?")
print("What color do you want your shape to be?")
color = "blue"
input = color("What color do you want your shape to be?")
What is the purpose of the "input" function in the provided Python code?
To ask the user for information
To display a message on the screen
To perform a calculation
To import a module
Which Python module is imported at the beginning of the code?
turtle
math
random
os
What does the line "turtle.right(360/sides)" do in the code?
Turns the turtle by an angle so that a regular polygon is drawn
Moves the turtle forward by 360 units
Turns the turtle left by 360 degrees
Ends the drawing
If a user enters "4" when asked "How many sides do you want your shape to have?", what shape will the turtle draw?
A square
A triangle
A pentagon
A circle
Why is the value 360 divided by the number of sides in the code?
To calculate the angle needed to turn and complete a regular polygon
To find the length of each side
To determine the number of times the loop runs
To set the speed of the turtle
How does the code use a variable to store user input?
It assigns the user's answer to the variable "sides"
It prints the user's answer
It ignores the user's answer
It uses the variable "turtle"
What would happen if you changed "turtle.forward(50)" to "turtle.forward(100)" in the code?
The sides of the shape would be longer
The shape would have more sides
The turtle would turn faster
The code would not run
Which of the following keywords is NOT mentioned as a keyword at the bottom of the page?
loop
input
output
variable
What does the error message "TypeError: 'str' object cannot be interpreted as an integer" mean in Python?
You are trying to use a string where an integer is expected.
You are trying to use an integer where a string is expected.
You are trying to use a float where a string is expected.
You are trying to use a boolean where an integer is expected.
Which of the following is a way to fix the error "TypeError: 'str' object cannot be interpreted as an integer" in Python?
Convert the string to an integer using int().
Convert the integer to a string using str().
Use a float instead of a string.
Ignore the error and run the code again.
What is a variable used for in Python programming?
To store data that can be used later in the program.
To display images on the screen.
To create sound effects.
To change the color of the text.
Which of the following keywords is NOT related to the topic discussed in the material?
Python
variable
syntax
biology
How can you combine the use of outputs and variables in a Python program for a given scenario?
By storing user input in a variable and then printing it as output.
By only using print statements without variables.
By only using variables without any output.
By ignoring user input and output.
What does "str" mean in Python?
String
Structure
Storage
Start
Which of the following is an example of an integer?
3.5
"hello"
0
True
Why is it important to use an integer when asking for the number of sides in a shape?
Because integers are always positive
Because the number of sides must be a whole number
Because strings cannot be used in Python
Because decimals are easier to use
Which of the following is NOT an integer?
-50
1
0
2.5
If you want to store the number of sides of a shape in a variable, which data type should you use?
String
Integer
Boolean
List
What is the purpose of adding "int(" before the input function in Python?
To make sure the user input is an integer.
To print the user input.
To store the user input as a string.
To display an error message.
Which of the following lines of code will store the user's input as an integer in Python?
sides = int(input("How many sides do you want your shape to have?"))
sides = input("How many sides do you want your shape to have?")
sides = str(input("How many sides do you want your shape to have?"))
sides = print(input("How many sides do you want your shape to have?"))
Why is it important to use int() when asking for a number input in Python?
It ensures the input is treated as a number for calculations.
It makes the code run faster.
It changes the color of the text.
It saves the input to a file.
If you use input() without int(), what type of data will be stored in the variable?
String
Integer
Boolean
Float
Suppose you want to ask the user for the number of sides of a shape and use that number in a calculation. Which code should you use and why? (DoK Level 3)
sides = int(input("How many sides do you want your shape to have?")) because it converts the input to an integer.
sides = input("How many sides do you want your shape to have?") because it is easier to write.
sides = str(input("How many sides do you want your shape to have?")) because calculations need strings.
sides = print(input("How many sides do you want your shape to have?")) because print stores the value.
What is the main goal of the Bronze level in this lesson?
Be able to write python code that will be output to the user
Understand what a variable is and use it to store data to output to the user
Combine the use of outputs and variables for a given scenario
Correct your code
Which of the following best describes the Silver level objective?
Combine the use of outputs and variables for a given scenario
Understand what a variable is and use it to store data to output to the user
Correct your code
Be able to write python code that will be output to the user
What is the Gold level task for students in this lesson?
Combine the use of outputs and variables for a given scenario
Correct your code
Understand what a variable is and use it to store data to output to the user
Be able to write python code that will be output to the user
Which of the following keywords is NOT listed as important for this lesson?
loop
input
output
variable
If you are feeling confident, what are you encouraged to do in Lesson 3 Activity 3?
Try the challenge
Skip the activity
Ask for help
Review the previous lesson
What is the main purpose of a variable in Python programming?
To store data that can be used and changed in a program
To display images on the screen
To connect to the internet
To print documents
Which of the following is an example of output in Python?
print("Hello, World!")
input("Enter your name: ")
variable = 5
def function():
What should you do at the end of a lesson according to the workbook plenary?
Write down what went well and what could be improved
Leave the classroom immediately
Start a new lesson
Ignore the lesson summary
If you have combined the use of outputs and variables for a given scenario, which medal have you achieved according to the lesson objectives?
Gold
Silver
Bronze
Platinum
