str Flashcards

1
Q

s.capitalize()

A

returns a copy of s with first character capitalized

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

s.count(target)

A

returns the number of occurences of target in s

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

s.find(target)

A

returns the index of the first occurrence of target in s

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

s.lower()

A

returns lowercase copy of s

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

s.replace(old, new)

A

returns copy of s with every occurrence of old replaced with new

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

s.split()

A

returns list of substrings of s

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

s.strip()

A

returns copy of s without leading and trailing whitespace

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

s.upper()

A

returns uppercase copy of s

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

new-line character

A

‘\n’

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

tab character

A

‘\t’


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

single quote character

A

’'’

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

double quote character

A

’"’

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

backslash character

A

’\’ 


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

13//3 vs 13//3

A

3+3+3+3+1 so
13//3=4 (int division)
13/3=4.3333 (float division)

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

13%3

A

3+3+3+3+1 so 13%3=1
(remainder in integer division)

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