Quiz on Python Bytes Function



1. What is the primary purpose of the bytes() function in Python?
2. Which of the following can be passed as an argument to the bytes() function?
3. What will be the output of bytes(5)?
4. How do you create a bytes object from a string 'Hello'?
5. What is the default encoding used by the bytes() function when converting a string?

Advertisements