How can you modify the given code to make the increment_counter() function correctly update and display the global counter variable?
Global vs local. Scopes
Escaping the local bubble
Report a typo
Fill in the gaps with the relevant elements
counter = 0
increment_counter():
counter
counter += 1
(f"Counter value: {counter}")
increment_counter()
increment_counter()
print(f"Final counter value: {counter}")Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.