Thanks for clearing that up. I knew it was much simpler than I was trying to make it I just couldn&#39;t quite see the logic that I needed for the problem clearly. Thanks for the elegant code.<br><br><div class="gmail_quote">
On Mon, Mar 9, 2009 at 10:53 PM, Moos Heintzen <span dir="ltr">&lt;<a href="mailto:iwasroot@gmail.com">iwasroot@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You&#39;re making it more complicated than it needs to.<br>
Also, you first used binnum then binum, and you didn&#39;t define binsum.<br>
<br>
It could easily be done like this:<br>
<div class="im"><br>
binnum = raw_input(&quot;Please enter a binary number:  &quot;)<br>
</div>decnum = 0<br>
rank = 1<br>
<br>
for i in reversed(binnum):<br>
    decnum += rank * int(i)<br>
    rank *= 2<br>
<br>
Moos<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br>