Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def dec_to_7(b: int):
- a = int(math.fabs(b))
- ans = ''
- while a > 0:
- ans = str(a % 7) + ans
- a //= 7
- if b > 0:
- return ans
- elif b < 0:
- return "-" + ans
- return 0
- a = int(input())
- print(dec_to_7(a))
Advertisement
Add Comment
Please, Sign In to add comment