Advertisement
dmemsm

Задача 6

Dec 15th, 2024 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. def to_decimal(num, base):
  2.     i = 1
  3.     result = 0
  4.     while num:
  5.         digit = num % 10
  6.         num = int(num / 10)
  7.  
  8.         result += digit * i
  9.         i = i * base
  10.     return result
  11.  
  12.  
  13. print(to_decimal(int(input()), int(input())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement