We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e3e2f23 commit a280191Copy full SHA for a280191
conversions/octal_to_decimal.py
@@ -21,7 +21,9 @@ def oct_to_decimal(oct_string: str) -> int:
21
is_negative = oct_string[0] == "-"
22
if is_negative:
23
oct_string = oct_string[1:]
24
- if not all(0 <= int(char) <= 7 for char in oct_string):
+ if not oct_string.isdecimal() or not all(
25
+ 0 <= int(char) <= 7 for char in oct_string
26
+ ):
27
raise ValueError("Non-octal value was passed to the function")
28
decimal_number = 0
29
for char in oct_string:
0 commit comments