Homework2
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user