We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e048d01 commit 974476dCopy full SHA for 974476d
conversions/decimal_to_any.py
@@ -1,34 +1,8 @@
1
"""Convert a positive Decimal Number to Any Other Representation"""
2
3
+from string import ascii_uppercase
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
-}
+ALPHABET_VALUES = {str(ord(c) - 55): c for c in ascii_uppercase}
32
33
34
def decimal_to_any(num: int, base: int) -> str:
0 commit comments