add exs
This commit is contained in:
1 parent
6361168409
commit
bfac007c85
9 files changed
+118
No files matched your search
@@ -0,0 +1,12 @@
|
||||
def from_base(digits, base):
|
||||
power = 1
|
||||
number = 0
|
||||
for digit in reversed(digits):
|
||||
number += power * digit
|
||||
power *= base
|
||||
return number
|
||||
|
||||
digits = [int(input("digit_a : ")), int(input("digit_b : ")), int(input("digit_c : ")), int(input("digit_c : "))]
|
||||
base = int(input("base : "))
|
||||
|
||||
print(from_base(digits, base))
|
||||
Reference in new issue
Block a user