Chapter 8 - More About Strings Flashcards

1
Q

Characters are stored in

A

numeric form

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Two commonly used types of code:

which one does python use?

A

ASCII, and Unicode UTF-8

python uses unicode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

string:

A

a sequence of 1 or more individual characters that could consist of letters, numbers, white space, characters, or symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

character:

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

are strings mutable or immutable?

A

Immutable. Strings cannot be changed once created.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

will this work?

string[index] = new_character

A

NO. you cannot change a string once created

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why use unicode instead of ascii?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

One major advantage of using strings:

A

they can be accessed both forwards and backwards

How well did you know this?
1
Not at all
2
3
4
5
Perfectly