Python String Methods Quiz
3 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

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?

  • split()
  • capitalize()
  • replace() (correct)
  • join()

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?

  • split()
  • replace()
  • join()
  • strip() (correct)

More Like This

Python String Methods Quiz
5 questions
Python String Methods Quiz
7 questions
Python String Methods Quiz
10 questions
Python String Methods Quiz
5 questions
Use Quizgecko on...
Browser
Browser