Skip to content

Commit 974476d

Browse files
CaedenPHcclauss
andauthored
Update conversions/decimal_to_any.py
Co-authored-by: Christian Clauss <[email protected]>
1 parent e048d01 commit 974476d

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

conversions/decimal_to_any.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,8 @@
11
"""Convert a positive Decimal Number to Any Other Representation"""
22

3+
from string import ascii_uppercase
34

4-
ALPHABET_VALUES = {
5-
"10": "A",
6-
"11": "B",
7-
"12": "C",
8-
"13": "D",
9-
"14": "E",
10-
"15": "F",
11-
"16": "G",
12-
"17": "H",
13-
"18": "I",
14-
"19": "J",
15-
"20": "K",
16-
"21": "L",
17-
"22": "M",
18-
"23": "N",
19-
"24": "O",
20-
"25": "P",
21-
"26": "Q",
22-
"27": "R",
23-
"28": "S",
24-
"29": "T",
25-
"30": "U",
26-
"31": "V",
27-
"32": "W",
28-
"33": "X",
29-
"34": "Y",
30-
"35": "Z",
31-
}
5+
ALPHABET_VALUES = {str(ord(c) - 55): c for c in ascii_uppercase}
326

337

348
def decimal_to_any(num: int, base: int) -> str:

0 commit comments

Comments
 (0)