def binary(decimal) : otherBase = "" while decimal != 0 : otherBase = str(decimal % 2) + otherBase decimal //= 2 return otherBaseprint binary(10)
output:
1010
def binary(decimal) : otherBase = "" while decimal != 0 : otherBase = str(decimal % 2) + otherBase decimal //= 2 return otherBaseprint binary(10)
output:
1010