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

Nathan Pinno falcon3166 at hotmail.com
Sat Sep 17 03:47:16 CEST 2005


cq is for "current question" and q is for "question"
therefore cq >= q should be correct most of the time
----- Original Message ----- 
From: "Danny Yoo" <dyoo at hkn.eecs.berkeley.edu>
To: "Nathan Pinno" <falcon3166 at hotmail.com>
Cc: <Tutor at python.org>
Sent: Friday, September 16, 2005 7:39 PM
Subject: Re: [Tutor] Why won't it enter the quiz?


>
>
>> 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