42 is an example of.....
An integer
colors = ["red", "blue", "green"]
What is the index of "red"? (in python)
0
A ____ loop is used when something repeats a fixed amount of time.
For loop
This keyword starts a conditional in most programming languages.
If
x = 7
if x > 5 and x < 10:
print("Yes")
else:
print("No")
What will be printed?
Yes
True is an example of...
A boolean
The variable age is used to represent a person’s age, in years. What is the most appropriate data type for age?
Integer
A _____ loop is used when something repeats until a condition is met.
While
This part of the conditional runs when the condition is false
else
What does modulus do?
Checks the remainder of a number
"How old are you?" is an example of....
A string
blist = [4,5,6]
print(alist + blist)
What will the code print?
1,2,3,4,5,6
for i in range(5):
print("hello")
What is printed?
hello five times
You can enter a game if you are 13 or older. What conditional represents this?
if age >= 13
if x > 10:
print("Big")
What is the error in this code?
Missing indentation
5.08 is an example of...
A float
The variable isOpen is used to indicate whether or not a store is currently open. What data type best represents isOpen?
Boolean
numbers = [1,2,3,4]
print(len(numbers))
What is printed?
4
A discount applies if a customer is a member OR spends more than $50. Write the condition.
if is_member or total > 50
A student passes if they score 65 or higher AND have less than 10 absences. Write the condition.
if score >= 65 and absences < 10
age = int(input("enter your age:"))
What is the purpose of "int" in the code here?
"int" is used for data casting - changes the users input from a string to an integer
animals = ["dog", "cat", "bird"]
animals.pop(2)
print(animals)
What is printed?
[dog, cat]
sky = blue
While True:
print("the sky is blue")
Whats the problem with this code?
Infinite loop, no end condition
if x > 5:
print("A")
elif x > 3:
print("B")
Why might "B" never print for some values?
values greater than 5 already satisfy the first condition
if x = 5:
print("Hi")
What is the error in this code?
= instead of ==