[Tutor] python question

Kent Johnson kent37 at tds.net
Sat Nov 22 23:07:26 CET 2008


On Sat, Nov 22, 2008 at 2:39 PM, spir <denis.spir at free.fr> wrote:

> -1- Give each of your texts a name (Qn,An,...). Use these names to program
> the logic. Associate a value to all of these names, creating 'constants', at
> e.g. the head of your programm.
> -2- Do the same, but in a separate file, called a 'module'. Then import this
> module at start. If you need help for that, ask.

If you give names to each separate question you will still end up with
a lot of similar code, even if it is just a function call like
score += ask_question(Q1, A1A, A1B)

Better is to think about structuring the data into lists and
processing in a loop.

Kent


More information about the Tutor mailing list