Podcast
Questions and Answers
Which of the following is a Python string method that returns a new string with all occurrences of a specified substring replaced by a new string?
Which of the following is a Python string method that returns a new string with all occurrences of a specified substring replaced by a new string?
- split()
- capitalize()
- replace() (correct)
- join()
What Python string method returns a new string with all the characters in uppercase?
What Python string method returns a new string with all the characters in uppercase?
- lower()
- swapcase()
- capitalize()
- upper() (correct)
What Python string method returns a new string with leading and trailing whitespace removed?
What Python string method returns a new string with leading and trailing whitespace removed?
- split()
- replace()
- join()
- strip() (correct)