Week 7: Strings Flashcards

(15 cards)

1
Q

String Slicing

A

You can isolate parts of a string using slice notation. my_str[start:end]

e.g. if my_str is Boggle, then my_str[0:3] outputs Bog.

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

Common slicing operations (table)

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

Stride

[0, 10, 1]

A

This determines how much the program will increment the index after reading each element.

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

Alignment Characters (<, >, ^)

A

These characters can be used to determine how a value will be aligned within the width of the field.

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

What are fill characters?

A

These are used to fill up empty space within the field width.

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

Floating-point Precision

A

Using an f string you can tell the program how many decimals (how precise) a float value can be.

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

finding and replacing string values:

replace(old, new)

A

This returns a copy of the string with all the occurances of the substring “old” will be replaced by the string “new”

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

Finding and replacing String values:

replace(old, new, count)

A

This also replaces all “old” with “new” BUT only replaces the first count occurrences of old.

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

Common methods for finding characters in strings (table)

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

String comparisons (table)

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

Other methods to check a strings value (table)

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

Transforming or creating new string methods (table)

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

split()

A

This method spilts a string into a list of tokens so that each token becomes a substring that forms a part of a larger string.

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

separator

A

These are characters that indicate where to split the string into tokens.

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

join()

A

This is a string method that does the opposite of split().

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