def convert_base(n, b): """ convert_base(integer, integer) -> string Return the textual representation of n (decimal) in base 2 <= b <= 10 """ result = "" while n!=0: digit = n%b n = n//b result = str(digit) + result return result #problems: wrong result for n=0, infinite loop for n<0, does not support b > 10