Font size
WorksheetsProgramming Sandbox Week 1
Total questions: 71
Worksheet time: 1hrs 20mins
When Python runs a program, which direction does it read the code? Mark only one oval.
Bottom to top
Top to bottom
Left to right only
It reads all lines at once
What does the print() function do in Python?
Fill in the blank: The (a) function asks the user a question and waits for them to type an answer.
What is a variable in Python? Mark only one oval.
A type of loop
A place to store information
A way to ask questions
A math problem
Code example:
color = input("What is your favorite color? ")
print("I like", color, "too!")
What will happen when this program runs?
Write a line of code that asks the user "What is your name?" and stores their answer in a variable called name.
What does print() do? Mark only one oval.
Shows text on the screen
Asks the user a question
Stores information
What does input() do? Mark only one oval.
Shows text on the screen
Asks the user a question
Stores information
What does a Variable do? Mark only one oval.
Shows text on the screen
Asks the user a question
Stores information
Why is it helpful to use formatting like titles, spacing, and labels in your programs?
Write a short program (2–3 lines) that asks the user for their favorite animal and then prints a message using their answer.
True or False: In the Creative Coding Sandbox activities, there is only one correct way to solve each practice problem. Mark only one oval.
True
False
Look at this program idea: "Ask the user to choose between being a wizard or a scientist, then print a message that matches their choice." What would you need to use to make this program work? Choose all that apply.
input() to ask the question
A variable to store the answer
print() to show the response
A calculator
Describe one thing you could add to a "Silly Story Generator" program to make it more fun or interesting.
Coding Time — The Friendly Greeter: Create a program that asks for the user's name and prints a friendly greeting. Try to make it sound welcoming or funny. Bonus idea: Add a second question (favorite color, animal, or food). Paste your code and output here.
Why should you think about regarding formatting your code?
How formatting makes your program easier to read
How to hide text from the user
How to remove all spacing
How to avoid labels
According to the listed requirements for the program where the experience matters, which items must your program include? Select all that apply.
Clear instructions
Friendly language
Organized output
A strong opening and closing message
Random keyboard shortcuts
In the instruction to "Design for the User," what is the primary focus of the program?
User experience
Algorithm efficiency
Data storage capacity
Network security policies
What is the function of the code:
amount = int(input("Enter a conversion into pounds:))
currency = input ("press 1 for indian rupees, 2 for Chinese yuan or 0 to exit:")
to find the total amount of currency altogether
to calculate and convert the exchange rates.
The variable num is what type?
str
int
float
num
In python the ' INTEGER data type' can be defined as...?
holds alphanumeric data as text
holds whole numbers
holds numbers with a decimal point
holds either ‘true’ or ‘false’
In python the ' BOOLEAN data type' can be defined as...?
holds alphanumerical data
holds whole numbers
holds a number with a decimal point
holds either true or false
What is the data type return for this code: print(type(3.0))
<class 'int'>
<class 'str'>
<class 'float'>
<class 'bool'>
If my_variable = "lunch", what is the data type of my_variable?
integer
word
string
boolean
What is the data type of the value "True" in Python?
int
str
bool
float
What programming language are we learning/ using?
Python
Scratch
Java
C++
In Python, what is output?
Built-in tools, such as print
Text in parentheses
The name of a variable
The result of the code, what is seen when it runs
How would you create a program to display "Hello World!"?
Which of the following is the correct way to display the value of a variable called score in Python?
print(score)
display(score)
output(score)
show(score)
What will be the output of the following code?name = input("Enter your name: ")
print("Hello, " + name)
It will print 'Hello, ' followed by whatever the user types.
It will print only 'Hello, name'.
It will show an error.
It will print 'Enter your name: Hello, name'.
Which statement correctly assigns the value 10 to a variable called age in Python?
age = 10
int age = 10
10 = age
age : 10
How does Python handle the division of a number by zero when using integers?
It returns a ZeroDivisionError.
It returns zero as the result.
It converts the division to a float division and returns infinity.
It prompts the user to enter a non-zero divisor.
What is Python?
text based programming language
Monty Python
spreadsheet
a cow
Computational thinking is the process of
touching grass
finding the problem, breaking it down and finding a solution using computer science principles like decomposition, pattern recognition, abstraction, and algorithmic thinking to formulate problems and design solutions.
watching a movie
farming aura
The syntax in Python is one of the main advantages over other high level programming languages.
True
False
Which of the following is true about Python code?
Punctuation is not important
It is used in every computer program
Math is never involved
Capitalization matters because it is case sensitive
What symbol is used in python to assign values to a variable?
equals =
plus +
forward slash /
asterisk *
Which of the following is a valid variable name in Python?
value_2
value-2
2value
value 2
Which function is used to get input from the user in Python?
output()
input()
read()
scan()
Based on the following code, what gets printed to the screen?
greeting = 7
name = "Bob"
greeting = "Hello"
print(greeting)
(a)
Suppose you have variable x = 4 and y = 2. What will get printed to the screen when this is executed?
print(x / y)
error
farm
x / y
2.0
Which choice below correctly prints out the value of the variable?
city = "Searcy"
print(cat)
print("city")
print(0)
print(city)
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
True
False
To create a newline at the end of prompt, you can use which of the following expressions?
\n
duh
no
break
What will be the output of the following code?
print(5 * 3)
53
error
15
8
If you want to add two numbers entered by the user, which code would you use?
sum = print() + print()
sum = input() + input()
sum = int(input()) + int(input())
sum = str(input()) + str(input()
Which of the following will print 'Python is fun!' to the screen?
print('Python is fun!')
output('Python is fun!')
show('Python is fun!')
display('Python is fun!')
Which of the following statements will create a variable named score with the value 10?
score -> 10
score == 10
score: 10
score = 10
Which of the following is NOT a valid data type in Python?
int
bool
float
char
What will be the output of the following code?
print(type(42.0))
<class 'str'>
<class 'float'>
<class 'bool'>
<class 'int'>
Which symbol is used to start a comment in Python?
--
/*
#
//
def sayHi():
print("hi there")
sayHi()nothing
sayHi()
an error message
hi there
Which function is called to display a message on the screen?
input
int
chr
What will be the output of the following code?
print(5 * 2)
10
7
25
error
Which data type would you use to store a person's age in Python?
int
str
bool
float
What is the variable when setting a thermometer?
How many people are in the room
The room you are in
The temperature
None
A computer program is best described as a series of ___________.
Instructions
Questions
Answers
Numbers
What is another term for a mistake in a computer program?
Bug
Cow
Cat
Dog
What is wrong with the following "code" for opening a bottle?
1. Grip cap with index finger and thumb
2. Remove cap
3. Twist counter-clock-wise until seal is broken
too many steps
bad
wrong
instructions are out of sequence
Write a Python program that asks the user for two numbers and prints their sum.
Example Input/Output:
Enter first number: 5
Enter second number: 7
The sum is 12
Write a Python program that asks the user for a number and prints its multiplication table up to 10.
Example Input/Output:
Enter a number: 3
3 x 1 = 3
3 x 2 = 6
...
3 x 10 = 30
Write a Python program that asks the user for a number and prints its square.
Example Input/Output:
Enter a number: 4
The square of 4 is 16
Write a Python program that asks the user for three numbers and prints their average.
Example Input/Output:
Enter first number: 5
Enter second number: 10
Enter third number: 15
The average is 10.0
Write a Python program that asks the user for principal, rate, and time, then calculates simple interest using the formula in the attached image.
Example Input/Output:
Enter principal: 1000
Enter rate: 5
Enter time (years): 2
Simple Interest is 100.0
print("2" + 3)
print(2 * 3)
print(2 * "3")
print("2" * 3)
Which symbol represents multiplication?
*
/
+
**
Which code would display 'Hello World'
Print("Hello World")
print("Hello World")
print(Hello World)
print=("hello world")
What does the following Python code display?
print("Hello")
print("World")
Hello
World
HelloWorld
Hello World
Hello
World
x = 5
y = 6
print("x*y")
The code above displays the following:
11
x*y
Syntax Error
30
x = 5
y = 6
print(x*y)
The code above displays the following:
11
x*y
Syntax Error
30
A line of text that Python won't try to run as code
comment
modulo
variable
boolean
