Advanced
Python
Q101 / 101
What is the bytearray type and when would you use it over bytes?
Correct! Well done.
Incorrect.
The correct answer is B) A mutable sequence of bytes, useful for in-place binary data manipulation without creating new bytes objects
B
Correct Answer
A mutable sequence of bytes, useful for in-place binary data manipulation without creating new bytes objects
Explanation
bytearray is mutable; bytes is immutable. Use bytearray when building binary protocols incrementally to avoid creating many immutable bytes objects.
Progress
101/101