Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Python Basics Exercises: Strings and String Methods (Summary)

In this video course, you’ve reinforced your knowledge of Python string objects. You can now confidently access different characters in a string using indices and slices, and you can determine the length of a string with len().

You also practiced methods. You used .upper() and .lower() to convert all characters of a string to uppercase and lowercase, respectively. With .rstrip(), .lstrip(), and .strip(), you removed whitespace from strings, and you figured out if a string starts or ends with a given substring through .startswith() and .endswith().

You also practiced capturing input from a user as a string using the input() function, and you converted that input to a number using int() and float(). You converted numbers and other objects to strings using str().

Finally, you used the .find() and .replace() methods to find the location of a substring and replace a substring with a new string.

For more on these concepts, check out the following video courses:

You can also read these tutorials:

To continue your Python learning journey, check out the other Python Basics courses. You might also consider getting yourself a copy of Python Basics: A Practical Introduction to Python 3.

Download

Sample Code (.zip)

12.8 KB
Download

Course Slides (.pdf)

6.8 MB

Become a Member to join the conversation.