Homework2
This commit is contained in:
@@ -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.
|
||||
# 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