The use of basic string manipulation Flashcards
1
Q
What is String manipulation?
A
- Act of manipulating extracting, or changing the characters in a string variable.
2
Q
How do you get the return the lenght of a string in python?
A
string= ‘hello’.
print(len(string))
3
Q
How do you convert a string to all capitals?
A
string=’hello’
string.upper()
returns HELLO.
4
Q
How do you convert a string to all lowercases?
A
string=’hello’
string.lower()
returns
hello.
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'