Please enable JavaScript to use CodeHS

Utah Introduction to Python 2

Lesson 5.4 Additional String Methods

Description

In this lesson, students learn how to use four new methods, strip, replace, find, and count, to alter strings.


Objective

Students will be able to:

  • Use the strip method to remove leading and trailing whitespace from a string
  • Use the replace method to use a different character throughout a string
  • Use the find method to return the index value of the first location of a certain element in a string
  • Use the count method to return the number of times an element occurs in a string