The purpose of a comment in Python code.
What is to explain or provide notes about the code?
The first thing in a program that uses random numbers.
What is import random?
The / operator does this.
What is division?
The purpose of a loop.
What is to repeat code?
The definition of a conditional.
What is an if-statement?
The symbol used to start a comment in Python
What is #?
The range of the following number:
num = random.randint(5,10)
What is 5 to 10?
Solve:
4 + 2 * 10
24
The missing word:
for i in _______(5):
print("Hello")
What is range?
The three types of conditionals.
If, Elif, Else
The problem with this code:
num = 2
print(“You have ” + num + “potatoes!”)
What is a TypeError?
The problem with this code:
import random
num = randint.random(2,15)
import random
num = random.randint(2,15)
The problem with this code:
numA = 15
numB = 2
print(numA x numB)
numA = 15
numB = 2
print(numA * numB)
The problem with this code
for i in range(4)
print("Fish")
for i in range(4):
print("Fish")
The problem with this code:
if num == 3:
print("Duck")
elif:
print("Goose")
if num == 3:
print("Duck")
else:
print("Goose")
The line that will not run:
# This is line one
print('THIS IS LINE TWO')
print('This is line three')
What is line one?
The problem with this code:
import random
num = random.randint(18,9)
What is invalid range?
The number of arrow that come out of a conditional in a flow chart.
How many times will the word "Blueberry" print?
for i in range(3):
for j in range(4):
print("Blueberry")
What is 12?
The number of elifs per conditional.
What is infinite?
Fix this code:
age = input("Enter age: ")
print("In five years you will be " + age + 5)
age = input("Enter age: ")
print("In five years you will be " + str(int(age) + 5))
Fix this code:
import random
num = int(input("Pick a number less than 10"))
newNum = random.randint(12, num)
import random
num = int(input("Pick a number less than 10"))
newNum = random.randint(num, 12)
Fix this code:
numA = 28
numB = 30
#find the average
avg = (numA + numB) \ 2
numA = 28
numB = 30
#find the average
avg = (numA + numB) / 2
The purpose of the variable 'i'?
What is counting the number of times the loop has run?
Fix this code:
if num => 8:
print("Bigger than seven")
elif num == 9:
print("It's a nine")
if num >= 8:
print("Bigger than seven")
elif num == 9:
print("It's a nine")