What is the output?
i = "Johnny"
i = "Janey"
print(i)
Janey
What is the output?
a = 1
b = a + 5
print(a + b)
7
What is the output if x is 3?
if x > 5:
print("large")
else:
print("small")
small
What is the output?
i = 1
while i < 3:
print(i)
i += 1
1
2
Fill in the blank so the code outputs a random number from 1 to 100 inclusive.
import random
print(random.randint(____))
1, 100
What is the output?
firstName = "Eleanor"
lastName = "Durrance"
print(firstName,lastName)
Eleanor Durrance
What is the output?
print(9 + 1 * 3 - 2)
10
What is the output if the user inputs Lonnie?
userName = input("Who are you?")
print("Hi", userName)
Hi Lonnie
What is the output?
i = 1
while i < 4:
print(i)
i += 2
1
3
What numbers can be generated by the below program?
import random
print(random.randint(1,10) * 8)
8
16
24
32
40
48
56
64
72
80
What is the output?
for i in range(3):
print(i)
0
1
2
What is the output?
print(5 - 1.0 / 2)
4.5
What is the output if the user inputs "great"?
response = input("How are you?")
if response == "Great":
print("Glad to hear.")
else:
print("Have a good day.")
Have a good day.
What is the output?
i = 6
while i > 0:
print(i)
i -= 2
6
4
2
Fill in the blank to choose a random item from the list and print it.
import random
myList = ['car', 109, 'False', 10, 'Football']
____________________________
random.choice(myList)
Fill in the blank so the following code outputs the given statement 8 times.
for i in ________:
print("Write this 8 times")
range(8)
What is the output?
print(3 % 2)
1
What is the output?
x = 23
y = 24
r = 2
s = 3
if y > x and s > r:
print("Both sides are true")
else:
print("Nope")
Both sides are true
What is the output?
i = 12
j = 3
while i > 0 and j != 0:
i -= 2
j -= 1
print(i)
10
8
6
Fill in the blank to shuffle the given list
import random
myList = ['car', 109, 'False', 10, 'Football']
____________________________
random.shuffle(myList)
Consider the following code.
for i in range(n):
print(i)
What is n if running the code outputs the following:
0
1
2
3
n = 4
What is the output?
a = 3
b = 5
c = b - a
print(a * b % c)
1
What is the output?
score = 60
if score > 60:
print("D")
elif score > 70:
print("C")
elif score > 80:
print("B")
elif score > 90:
print("A")
else:
print("F")
F
userInput = input("What infraclass do koalas belong to?")
while userInput != "marsupial":
userInput = input("Wrong! What infraclass do koalas belong to?")
print("That is correct")
How many times is the while loop condition checked if the console dialog is as follows:
What infraclass do koalas belong to? mammal
Wrong! What infraclass do koalas belong to? crustacean
Wrong! What infraclass do koalas belong to? reptilia
Wrong! What infraclass do koalas belong to? marsupial
That is correct
4
What would the output be?
for i in range(100):
print(random.randint(1,8))
A random number between 1-8