Skip to main content

Accepted Answer · #18 · 2026-04-22

Which answer is correct?

Difficulty 2/3

How to play

Read the Stack Overflow–style question, then pick the one correct answer from four plausible options. Watch out — wrong answers often have high fake votes.

Why can't I modify a global variable inside a function in Python?

I have `count = 0` at module level and `count += 1` inside a function, but I get `UnboundLocalError`.

pythonscopeglobal

Loading your progress...

Press 1 through 4, or tap a numbered choice, to answer. Back to hub