Skip to content

Commit cb34c5f

Browse files
Update conversions/octal_to_hexadecimal.py
fix: readability improvements in octal_to_hexadecimal.py Co-authored-by: Tianyi Zheng <[email protected]>
1 parent ea016c9 commit cb34c5f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

conversions/octal_to_hexadecimal.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ def octal_to_hex(octal: str) -> str:
2727
octal = octal[2:]
2828
if octal == "":
2929
raise ValueError("Empty string was passed to the function")
30-
for char in octal:
31-
if char not in "01234567":
32-
raise ValueError("Not a Valid Octal Number")
30+
if any(char not in "01234567" for char in octal)
31+
raise ValueError("Not a Valid Octal Number")
3332

3433
decimal = 0
3534
for char in str(octal):

0 commit comments

Comments
 (0)