Chapter 8 - More About Strings Flashcards
Characters are stored in
numeric form
Two commonly used types of code:
which one does python use?
ASCII, and Unicode UTF-8
python uses unicode
string:
a sequence of 1 or more individual characters that could consist of letters, numbers, white space, characters, or symbols
character:
a symbol that could be from an alphabet, special character, etc. similar to how integers are converted to binary values by the compiler, characters are converted to UNICODE values in python
are strings mutable or immutable?
Immutable. Strings cannot be changed once created.
will this work?
string[index] = new_character
NO. you cannot change a string once created
Why use unicode instead of ascii?
Unicode:
-more generalized and consists of a value for every possible character in every possible language.
-able to display messages in a variety of languages and symbols
- better choice for encoding
ASCII:
- represents very limited set of alphabets or symbols like lowercase (a-z), digits (0-9), symbols, etc.
One major advantage of using strings:
they can be accessed both forwards and backwards