From 72613341c8dd6f2d7ac6c2ea2881fcfaed5c67d7 Mon Sep 17 00:00:00 2001 From: SIDDHESH SADARAO <137042983+siddheshsadarao@users.noreply.github.com> Date: Sun, 19 Oct 2025 23:27:06 +0530 Subject: [PATCH 1/4] Add function to convert ASCII to character --- conversions/ascii_to_char.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 conversions/ascii_to_char.py diff --git a/conversions/ascii_to_char.py b/conversions/ascii_to_char.py new file mode 100644 index 000000000000..04822b5c3ba4 --- /dev/null +++ b/conversions/ascii_to_char.py @@ -0,0 +1,7 @@ +def ascii_to_char(ascii_val: int) -> str: + """Convert ASCII value to corresponding character.""" + return chr(ascii_val) + +if __name__ == "__main__": + num = int(input("Enter ASCII value: ")) + print("Character is:", ascii_to_char(num)) From 5ef880ff29a62b05ec833b74b443898c4f4e4682 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 19 Oct 2025 18:04:47 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- conversions/ascii_to_char.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conversions/ascii_to_char.py b/conversions/ascii_to_char.py index 04822b5c3ba4..9e138fb5bc23 100644 --- a/conversions/ascii_to_char.py +++ b/conversions/ascii_to_char.py @@ -2,6 +2,7 @@ def ascii_to_char(ascii_val: int) -> str: """Convert ASCII value to corresponding character.""" return chr(ascii_val) + if __name__ == "__main__": num = int(input("Enter ASCII value: ")) print("Character is:", ascii_to_char(num)) From 235a870fccde04c1f8ff2e11c32ce26db9658e16 Mon Sep 17 00:00:00 2001 From: SIDDHESH SADARAO <137042983+siddheshsadarao@users.noreply.github.com> Date: Sun, 19 Oct 2025 23:37:37 +0530 Subject: [PATCH 3/4] Update ascii_to_char.py Added docstring as requested --- conversions/ascii_to_char.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conversions/ascii_to_char.py b/conversions/ascii_to_char.py index 9e138fb5bc23..fc86fa0bc830 100644 --- a/conversions/ascii_to_char.py +++ b/conversions/ascii_to_char.py @@ -1,3 +1,9 @@ +""" +This script converts an ASCII value to its corresponding character. +Example: + Input: 65 + Output: A +""" def ascii_to_char(ascii_val: int) -> str: """Convert ASCII value to corresponding character.""" return chr(ascii_val) From 851b06c65342f04b79698391a8a487621ca83254 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 19 Oct 2025 18:07:57 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- conversions/ascii_to_char.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conversions/ascii_to_char.py b/conversions/ascii_to_char.py index fc86fa0bc830..230c7289fe16 100644 --- a/conversions/ascii_to_char.py +++ b/conversions/ascii_to_char.py @@ -4,6 +4,8 @@ Input: 65 Output: A """ + + def ascii_to_char(ascii_val: int) -> str: """Convert ASCII value to corresponding character.""" return chr(ascii_val)