Jun-23-2021, 07:14 AM
this is an assignment as i said before....
the code that i wrote down is:
so i need to fix this code...
the code that i wrote down is:
def sortlist(lst, i, b_ord ): if len(lst) == i: return lst elif b_ord > ord(lst[i]): lst[i - 1] = lst[i] lst[i] = chr(b_ord) b_ord = ord(lst[0]) i = 0 else: b_ord = ord(lst[i]) sortlist(lst, (i + 1), b_ord) lst = list(input()) n=ord('0') i=0 sortlist(lst,i,n) print("".join(lst))but it is reaching the limit of recursion, although when i try sorting a string on jupyter notebook it works..
so i need to fix this code...