MCPcopy Create free account
hub / github.com/geekcomputers/Python / convert_to_10

Function convert_to_10

Base Converter Number system.py:42–53  ·  view source on GitHub ↗
(xnumber, xbase, arr, ybase)

Source from the content-addressed store, hash-verified

40
41
42def convert_to_10(xnumber, xbase, arr, ybase):
43 if int(xbase) == 10:
44 for char in xnumber:
45 arr.append(char)
46 flipped = arr[::-1]
47 ans = 0
48 j = 0
49
50 for i in flipped:
51 ans = ans + (int(i) * (int(ybase) ** j))
52 j = j + 1
53 return ans
54
55
56arrayfrom = []

Callers 1

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected