No, that kind of questions shall be shot on sight.
It's a homework programming question.
Homework questions are ok (at least IMO) when:
They're explained well enough. That's the bare minimum for any question. Otherwise, close as "unclear what you're asking". That question barely meets this requirement doesn't meet this requirement at all.
It's clear that OP at least tried to solve the problem alone. That question doesn't meet this requirement.
Pure programming questions instead are just not ok. They're off-topic. Python is a programming language, and we close question about Python that have nothing to do with Ubuntu: the answer that question would receive here isn't different from the answer it'd receive on Stack Overflow (leaving aside for a moment that it would be buried under downvotes and closed on Stack Overflow as well) and it's not specific to Ubuntu at all.
Mind that shell scripting questions are an exception to this. Shell scripting questions are on-topic and welcome here.
You're overreading the statement in the Help Center: "Development on Ubuntu" shall be read as in "What concerns development on Ubuntu", or of course as in "Development that is specific to the Ubuntu platform": more info here (thanks muru).
To make this clearer, other than questions about development that is specific to the Ubuntu platform (it's hard to make a detailed resume of all the possible approriate questions, but for example questions about platform-specific APIs) here are some sample questions that would be on-topic:
- My code needs library X in order to run. Which package provides library X?
- My code needs library X.1 in order to run. Library X.1 is installed but an older version of the library (X) is loaded instead. How do I force Ubuntu to load X.1 instead of X?