From 081471fa5d7f45367866dd34145219748cb1bd1c Mon Sep 17 00:00:00 2001 From: leonhuang Date: Fri, 26 May 2023 15:14:12 -0500 Subject: [PATCH] Homework2 --- Leon_Submissions/Homework2.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Leon_Submissions/Homework2.py b/Leon_Submissions/Homework2.py index d49a35d..302b335 100644 --- a/Leon_Submissions/Homework2.py +++ b/Leon_Submissions/Homework2.py @@ -19,4 +19,12 @@ print("Size of bytes:", bytes_size) # Emojis are represented using Unicode characters, which require more # bytes to store compared to ASCII characters. Therefore, if you have # a string that contains emojis, its size will be larger than a string -# without emojis. \ No newline at end of file +# without emojis. + +def print_string_as_numbers(input_string): + for char in input_string: + print(ord(char), end=' ') + +# Example usage +input_string = "Hello, World!" +print_string_as_numbers(input_string)