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

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Python Basics: Strings and String Methods (Summary)

In this video course, you learned the ins and outs of Python string objects. You learned how to access different characters in a string using indices and slices, as well as how to determine the length of a string with len().

Strings come with numerous methods. The .upper() and .lower() methods convert all characters of a string to uppercase and lowercase, respectively. The .rstrip(), .lstrip(), and .strip() methods remove whitespace from strings, and the .startswith() and .endswith() methods tell you if a string starts or ends with a given substring.

You also learned how to capture input from a user as a string using the input() function, and how to convert that input to a number using int() and float(). To convert numbers and other objects to strings, you use str().

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

For more information on the concepts you’ve covered in this course, check out:

Download

Sample Code (.zip)

9.6 KB
Download

Course Slides (.pdf)

2.3 MB

nb20pygeek on July 7, 2023

This is good!

Become a Member to join the conversation.