Skip to content

Commit 0ca904d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 61c87e4 commit 0ca904d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

conversions/ascii_to_char.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Convert a given ASCII value to its corresponding character.
33
"""
44

5+
56
def ascii_to_char(ascii_value: int) -> str:
67
"""
78
Converts an ASCII integer value to its character equivalent.
@@ -15,6 +16,7 @@ def ascii_to_char(ascii_value: int) -> str:
1516
"""
1617
return chr(ascii_value)
1718

19+
1820
if __name__ == "__main__":
1921
import doctest
2022

@@ -24,8 +26,10 @@ def ascii_to_char(ascii_value: int) -> str:
2426
try:
2527
ascii_val = int(input_value)
2628
if 0 <= ascii_val <= 127:
27-
print(f"The character for ASCII value {ascii_val} is: {ascii_to_char(ascii_val)}")
29+
print(
30+
f"The character for ASCII value {ascii_val} is: {ascii_to_char(ascii_val)}"
31+
)
2832
else:
2933
print("Please enter a valid ASCII value (0-127).")
3034
except ValueError:
31-
print("Invalid input. Please enter an integer.")
35+
print("Invalid input. Please enter an integer.")

0 commit comments

Comments
 (0)