[Tutor] python question

Kent Johnson kent37 at tds.net
Sat Nov 22 14:33:52 CET 2008

On Fri, Nov 21, 2008 at 1:31 PM, Daniel J Kramer
<constantfables at gmail.com> wrote:
> Hi
> I have just joined this list. I need some help working on a Python
> application I am working on.  I am working on a quiz game where the users
> gain points when the answer questions correctly.  I have written the
> skeleton of the quiz with If, Elif and Else statements.  it runs perfectly.
> I am very unclear on how to score points at the end of each round and how to
> import images.
> Can anyone help out here or have any ideas on the best way to execute this?
> I have included a copy of the quiz so you can get an idea of what I am
> trying to do

David has given you a hint about scoring points. Images are more
difficult because you can't display an image directly in the console,
you have to use a GUI toolkit. The EasyGUI buttonbox might do what you
need, or provide a starting point for customization:

Some tips about your program:
Rather than checking for upper- and lower-case versions of the answer,
you can convert the answer to lowercase and just check once, for
A11 = raw_input("...")
A11 = A11.lower()

Do you know about lists and loops yet? Your program would be much
simpler if you kept the questions and answers in a list. For each
question, you could store
question text
answer1, answer1 response, answer1 score
answer2, answer2 response, answer2 score
default response

Then your code would just loop over the questions.


More information about the Tutor mailing list