The use of basic string manipulation Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is String manipulation?

A
  • Act of manipulating extracting, or changing the characters in a string variable.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you get the return the lenght of a string in python?

A

string= ‘hello’.

print(len(string))

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

How do you convert a string to all capitals?

A

string=’hello’
string.upper()
returns HELLO.

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

How do you convert a string to all lowercases?

A

string=’hello’
string.lower()
returns
hello.

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

How do you return certain letters of a word?

A
string='hello'
each letter starts from 0.
so h= 0
string[0]
returns 'h'
string[1:5]
returns 'ello'
How well did you know this?
1
Not at all
2
3
4
5
Perfectly