Advertisement
STANAANDREY

lsd3 14

Oct 14th, 2022 (edited)
1,139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. def to_bin(n):
  2.     if n == 0:
  3.         return "0"
  4.  
  5.     r = ""
  6.     if n // 2 != 0:
  7.         r += str(to_bin(n // 2))
  8.     r += str(n % 2)
  9.     return r
  10.  
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement