string methods Flashcards

1
Q

method to find length of string

A

print(len(name))

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

method to find what position letter is in

A

print(name.find(“e”))

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

method to capitalize first letter of string

A

print(name.capitalize())

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

method to write string in all caps

A

print(name.upper())

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

method to write string in all lowercase letters

A

print(name.lower())

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

method to check if variable is a number

A

print(name.isdigit())

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

method to check if variable are letters

A

print(name.isalpha())

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

method to find how many letters are in the string

A

print(name.count(“e”))

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

method to replace letter with another letter

A

print(name.replace(“e”, “a”))

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

method to multiply string by a number

A

print(name*3)

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