230k views
3 votes
The letter 'e' has a hexadecimal value of 0x65. Which of the following statements prints the bytes literal value 'e'?

A) print(b'e')
B) print('e')
C) print(0x65)
D) print(bytes('e', 'utf-8'))

1 Answer

6 votes

Final answer:

The correct statement that prints the bytes literal value 'e' is option A) print(b'e'). Bytes literals are used to represent a sequence of bytes, which can be useful when working with binary data or text encoded in a specific character encoding.

Step-by-step explanation:

The correct statement that prints the bytes literal value 'e' is option A) print(b'e').

In Python, when a string is prefixed with 'b', it represents a bytes literal. Bytes literals are used to represent a sequence of bytes, which can be useful when working with binary data or text encoded in a specific character encoding.

Therefore, the statement print(b'e') will print the bytes literal value 'e'.

User Stefan De Bruijn
by
7.6k points