anonymous No title
No License Python
2022年04月01日
Copy Clone
def to_bin(x,ans):
    #print(x, ans)
    if x == 0:
        return ''.join(reversed(list(map(str,ans))))
    else:
        ans.append(x%2)
        return to_bin(x//2, ans)

while True:
    v = int(input())
    print(to_bin(v, []))
def to_bin(x,ans):
    #print(x, ans)
    if x == 0:
        return ''.join(reversed(list(map(str,ans))))
    else:
        ans.append(x%2)
        return to_bin(x//2, ans)

while True:
    v = int(input())
    print(to_bin(v, []))
No one still commented. Please first comment.
Output