Question on if, while, for.... Figured it out..

Paul Rubin phr-n2002a at nightsong.com
Mon Feb 11 17:40:17 EST 2002


"Steve Holden" <sholden at holdenweb.com> writes:
> > if num > den: #Test for improper fraction.
> >     i = num/den #This will only return the whole part.
> >     j = num%den #This will return only the remainder.
> >
> Rather than comment the usage of "i" and "j", why not just use "d" for
> dividend and "r" for remainder? The idea behind being able to choose
> variable names is to allow them to have some mnemonic significance.

I think Steve means quotient and remainder, not divident and remainder.

You might also like to error-check the input: what happens if den==0?



More information about the Python-list mailing list