Chapter 8 Flashcards

1
Q

Concatenation

A

Appending one string to the end of another string.

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

Slice

A

Span of items taken from a sequence; also known as substring.

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

in operator

A

You can use the in operator to determine whether one string is contained inside another string.

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

not in operator

A

You can use the not in operator to determine whether one string is NOT contained inside another string.

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

String methods

A

Strings in Python have many types of methods, divided into different types of operations. General format:

stringvar.method(argument)

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

endswith(substring)

A

Checks if the string ends with substring. Returns True or False.

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

startswith(substring)

A

Checks if the string starts with substring. Returns True or False.

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

find(substring)

A

Searches for substring within the string. Returns lowest index of the substring, or if substring is not found, returns -1.

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

replace(old, new)

A

Returns a copy of the new string where old is replaced with new.

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

Repetition operator (*)

A

Makes multiple copies of a string and joins them together. General format:

string_to_copy * n

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

split method

A

Returns a list containing the words in the string. By default, spaces are used as separators. Can specify a different separator by passing it as an argument, e.g. ‘/’.

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