Strings Flashcards

1
Q

How to escape / make effects?

A

\

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

How to tab text?

A

\t

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

How to newline?

A

\n

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

How to combine strings?

A

+

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

How to duplicate string?

A

‘string’ * 2 == ‘stringstring’

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

How to slice every other character?

A

string[::2]

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

What’s a string function?

A

string.function(argument)

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

How to split?

A

string.split(x)

Ex: ‘string’.split(‘i’) == [‘str’, ‘ng’]

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

How to join?

A

string. join(list)

e. g. ‘ ‘.join([‘ben’, ‘fred’] == ‘ben fred’

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

Swap upper and lowercase?

A

string.swapcase()

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

How to replace one string part with another?

A

string.replace(‘old’, ‘new’, how many instances to replace?)

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