by BlastRoom
Practice tracing Python function definitions, calls, parameters, return values, and local scope.
#computer_science

25 questions
One question set, multiple game modes. Tap any game to see it in action. Not sure which to pick?
Answer to place stones and capture territory.
Outrun the snow together.
Earn blasts, then hunt the other team.
Answer to earn energy, then climb.

The class blasts through walls together.
Bid on mystery lots. Most money wins.
Sell tours. Nice, standard, or a total scam.
Answer, restock, and serve the rush.
More correct answers pulls the rope your way.
Answer, then shoot down the alien wave.
Answer, then tap to leap the frozen ridge.
What does this Python program display? def scale(n): return n * 2 + 1 print(scale(5))
Trace the returned value in this Python program. def area(length, width): return length * width print(area(4, 6))
After this function call, what is printed? def shout(text): return text.upper() print(shout("go"))
What value does this program display? def remainder(value, divisor): return value % divisor print(remainder(17, 5))
What is the output of this Python code? def remove_first(word): return word[1:] print(remove_first("code"))
Which value is returned and printed here? def is_large(n): return n > 10 print(is_large(8))
What does this program display? def describe(animal, sound): return animal + " says " + sound print(describe("cow", "moo"))
In this call, which value is printed? def difference(start, end): return start - end print(difference(12, 5))
What output results from this function call? def join(left, right): return left + "-" + right print(join("north", "south"))
A programmer runs this code. What appears on the screen? def coordinates(row, column): return "r=" + str(row) + ", c=" + str(column) print(coordinates(2, 5))
What does the call return in this program? def divide(total, groups): return total // groups print(divide(17, 4))
What does this program display, in order? def greet(name): return "Hi " + name + "!" print(greet("Ana")) print(greet("Ben"))
When this code runs, what is printed in order? def next_level(level): return level + 1 print(next_level(2)) print(next_level(5))
Predict the two lines printed by this program. def frame(text): return "[" + text + "]" print(frame("A")) print(frame("B"))
What output is produced by these two calls? def multiply(a, b): return a * b print(multiply(2, 3)) print(multiply(4, 2))
A function is called twice below. What is displayed, in order? def log(item): print("Saved: " + item) log("map") log("photo")
What happens when this Python program runs? def bonus(score): extra = 5 return score + extra score = bonus(10) print(extra)
What happens after this code is run? def make_message(): message = "Ready" return message print(make_message()) print(message)
Which outcome is correct for this program? def make_count(): count = 3 return count make_count() print(count)
What does this code do? def double(number): return number * 2 double(4) print(number)
What does the last line, print(outcome), display? def finish(task): print("Finished " + task) outcome = finish("report") print(outcome)
What does this Python program display? def add(a, b): total = a + b result = add(3, 4) print(result)
What appears on the screen? def announce(name): print("Hello, " + name) print(announce("Mia"))
What value is printed by this program? def apply_tax(price): taxed = price * 1.05 receipt = apply_tax(20) print(receipt)
What does this program display, in order? def show_square(n): print(n * n) answer = show_square(4) print(answer)
Crack the passcode before the zombies get in.
Answer, then swat bugs for bonus points.
Race through questions at your own speed.
Same question on every screen. Fastest wins.

Pick a tile, answer, hit bonuses and steals.
Reading a Python Traceback
20 questions