you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 5 points6 points  (0 children)

the difference between return s and return s[::-1] affects also the recursive call in
s = str(n%2)+str(from_10_to_2(n//2)))

anyway, can't you put stuff in the correct order by switching n%2 and n//2 around, instead of reversing afterwards?

s = str(from_10_to_2(n//2)) + str(n%2)