[Tutor] Why won't it enter the quiz?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sat Sep 17 03:39:20 CEST 2005



> I've got this program I've written that should give an addition quiz,
> except it never enters the quiz. How do I make it enter the quiz?


Hi Nathan,


Let's look at a small snippet of the code.

>     q = random.choice(range(15,31))
>     cq = 1

What does 'q' stand for?  What does 'cq' stand for?

These aren't irrelevant questions, because you were doing fine with your
other variable names right up till then.

Your program isn't going to run any slower if you use longer variable
names.  *grin*  Until you get more experience, try using descriptive
names.  For myself, doing so usually jolts me into trying to make sure the
code reads well.


It also matters because I don't yet understand what the while's condition
is checking for:

>     while cq >= q:
            ^^^^^^^

Can you explain what this is trying to check?  I suspect that this
expression is "weird" in the sense that it doesn't check what you're
trying to check.


Best of wishes to you!



More information about the Tutor mailing list