Convert numbers to a certain base - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32) +---- Thread: Convert numbers to a certain base (/showthread.php?tid=5138) |
Convert numbers to a certain base - uber1337 - 03-03-2010 I posted this to help someone out over at HF. He had an assignment to be able to convert numbers to a certain base, but without using loops. The only thing he could use were recursions. I had no clue about recursions before I created this for him, so it was a learning experience for me, path math wise and programming wise ;). Basically, recursions are when you call a function inside the function itself, basically has the same principles as a loop, just different methods of coding.(you still need to provide and escape to escape the loop, etc.) Anyway here is the code. Code: import sys RE: Convert numbers to a certain base - Fallen - 04-05-2010 damn lol, more comments than actual code RE: Convert numbers to a certain base - uber1337 - 04-06-2010 (04-05-2010, 06:16 PM)Fallen Wrote: damn lol, more comments than actual code Yeah the person I did it for(it was his homework) wanted it well documented so he can understand it. Come to think of it I should have used triple quotes for documentation. |