Update page 'Day 1 homework - Xuanyi Wang (Sloetjes)'
@@ -79,7 +79,7 @@ Therefore, any calculation involving adding 0.01 to a dollar amount smaller than
|
|||||||
|
|
||||||
#### 7. Name three practical differences between Python strings and bytes. Using sys.getsizeof, see how the sizes may be different. Do emoji change this answer?
|
#### 7. Name three practical differences between Python strings and bytes. Using sys.getsizeof, see how the sizes may be different. Do emoji change this answer?
|
||||||
|
|
||||||
** Encoding**: Python strings are used to represent text data, while bytes are used to represent binary data. Strings are typically encoded using a character encoding such as UTF-8 or ASCII, which maps each character to a sequence of bytes, while bytes represent raw binary data that may not necessarily correspond to any particular character encoding.
|
**Encoding**: Python strings are used to represent text data, while bytes are used to represent binary data. Strings are typically encoded using a character encoding such as UTF-8 or ASCII, which maps each character to a sequence of bytes, while bytes represent raw binary data that may not necessarily correspond to any particular character encoding.
|
||||||
|
|
||||||
**Immutability**: Python strings are immutable, meaning that once a string is created, its contents cannot be changed. In contrast, bytes are mutable, meaning that their contents can be changed after they are created.
|
**Immutability**: Python strings are immutable, meaning that once a string is created, its contents cannot be changed. In contrast, bytes are mutable, meaning that their contents can be changed after they are created.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user