Get startedGet started for free

String Methods

Strings come with a bunch of methods. Follow the instructions closely to discover some of them. If you want to discover them in more detail, you can always type help(str) in the IPython Shell.

A string place has already been created for you to experiment with.

This exercise is part of the course

Introduction to Python

View Course

Exercise instructions

  • Use the .upper() method on place and store the result in place_up. Use the syntax for calling methods that you learned in the previous video.
  • Print out place and place_up. Did both change?
  • Print out the number of o's on the variable place by calling .count() on place and passing the letter 'o' as an input to the method. We're talking about the variable place, not the word "place"!

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# string to experiment with: place
place = "poolhouse"

# Use upper() on place
place_up = 

# Print out place and place_up



# Print out the number of o's in place
Edit and Run Code