Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import digits, ascii_lowercase
- def from_n_to_10(num: str, base: int = 2):
- alphabet = digits+ascii_lowercase
- assert base in range(2, 10+len(alphabet) + 1)
- res = 0
- for i in num:
- digit = alphabet.index(i)
- assert digit < base
- res = res*base + digit
- return res
- print(from_n_to_10(input()))
Advertisement
Add Comment
Please, Sign In to add comment