Homework2

This commit is contained in:
2023-05-26 15:14:12 -05:00
parent 291ba82046
commit 081471fa5d
+8
View File
@@ -20,3 +20,11 @@ print("Size of bytes:", bytes_size)
# bytes to store compared to ASCII characters. Therefore, if you have # bytes to store compared to ASCII characters. Therefore, if you have
# a string that contains emojis, its size will be larger than a string # a string that contains emojis, its size will be larger than a string
# without emojis. # 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)