Re[2]: [Tutor] Declare empty string variable?
Volker Hoffmann
Volker Hoffmann <volker@omega-fleet.dyndns.org>
Thu Jan 2 10:02:04 2003
Hi!
Quote - 30.12.2002, 18:53, ramrom@earthling.net:
> Observations:
> this program does not reassign to deci; therefore it is an endless
> loop. while deci>0: can just be while deci:
There actually was an additional line that reassigned deci somewhere
in the whole lot of 6 lines of code :). Thanks for the hint with >0,
seems to me that Python really is interesting.
> Try this:
> dual = ''
> deci = input("Decimal? --> ")
> while deci:
> deci,b = divmod(deci,2)
> dual=str(b)+dual
> print dual
I think I got it now. Thanks very much again to you and to Gonçalo,
too, of course :). On the bottom line, it all came down to str(b) that
I needed.
- Volker
--
"When the future hinges on the next words that are said,
don't let logic interfere, believe your heart instead."
- Philip Robison