Brian, I'm including the list back in on this reply, so that more than
just me can see your message and potentially help out.

On 6/8/07, Brain Murphy <[EMAIL PROTECTED]> wrote:
>
> this is what i have so far.
> x= 100
> b=2
> while x > 0:
>     print x
>     x=divmod(x,b)
>
> the problem is that since it is a tuple I can not use that last part, x =
> divmod(x,b)
> how can I put this in a loop?
> were it goes through the whole number, as in 100/2=50 50/2 25 ect.
> but also keeping the remiander?

Since divmod() returns a tuple, you need to unpack it.  For example:
>>> q, r = divmod(10, 3)
>>> print q
3
>>> print r
1

If you want to store all the remainders as you go, maybe you could
build up a list of remainders by starting with an empty list and
append() the values to the list as you go through the loop.

-- 
Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to