Bir sonni boshqa sanoq sitemasiga o'tkazish funksiyasi

PHOTO EMBED

Wed Apr 13 2022 15:52:08 GMT+0000 (Coordinated Universal Time)

Saved by @Abdujalil048 #python

def int2base(num, base, abc="0123456789abcdefghijklmnopqrstuvwxyz"):
  if num < 0:
    return '-' + int2base(-num, base, abc)

  else:
    output = abc[num % base] # rightmost digit

    while num >= base:
      num //= base # move to next digit to the left
      output = abc[num % base] + output # this digit

    return output
content_copyCOPY

https://stackoverflow.com/questions/2063425/python-elegant-inverse-function-of-intstring-base