Exercise: Fix the Global Counter
Bartosz Zaczyński RP Team on June 5, 2026
@bart.jutte Thanks for the honest feedback. You’re right that this exercise leans on parameters and return values, and those aren’t re-taught here in the Scopes course.
The Python Basics series is designed to be followed in order, and those two building blocks (passing a value into a function as a parameter, and sending one back with return) are introduced earlier in Python Basics: Functions and Loops, especially the “Creating Your Own Functions” lesson. The Scopes course builds on that one, which is why its overview links back to it.
In case it helps it click, here’s the shape of the intended fix. Instead of reaching out to the global variable:
counter = 0
def increment():
global counter
counter = counter + 1
you pass the current value in and return the new one, then store the result back:
counter = 0
def increment(current):
return current + 1
counter = increment(counter)
print(counter)
counter = increment(counter)
print(counter)
counter = increment(counter)
print(counter)
That still prints 1, 2, 3, but now increment() doesn’t depend on anything outside itself, which is the habit the exercise is nudging you toward. If the parameter-and-return pattern feels shaky, the Functions and Loops course is a good place to firm it up. Hope that helps 🙂
Become a Member to join the conversation.

bart.jutte on June 5, 2026
For me, solving this exercise required the use of some knowhow I didn’t come across before in the learning module(s). So I was not able to solve it with the required solution (parameter, use of current).