Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Basic utility functions
Basic manipulation functions
Replacing and splitting
Summary
12. Summary

Instruction

Well done! It's time to wrap things up.

  1. len() returns the string length.
  2. index(substr) and find(substr) return the index of the first occurrence of substr. If the substring is not found, index() raises a ValueError, and find() returns -1.
  3. count(substr) counts the number of occurrences of substr in a given string.
  4. isdigit() checks if any string characters are digits. For other is-functions, please see the Python documentation.
  5. str.isalpha() returns True if all characters in the string are letters.
  6. str.isalnum() returns True if all characters in the string are letters or digits.
  7. str.isspace() returns True if all characters in the string are whitespace characters.
  8. str.islower() and str.isupper() return True if all characters in the string are lowercase or uppercase, respectively.
  9. startswith(substr) and endswith(substr) check if the string begins or ends with substr, respectively.
  10. upper(), lower(), and capitalize() are used to change the case of letters in a string.
  11. strip(), lstrip(), and rstrip() are used to get rid of unnecessary characters at the beginning and/or end of a string.
  12. replace(old, new) replaces all instances of old with new.
  13. split(sep) splits the string into a list of substrings using the separator defined by sep.

All right! Time to practice your skills!

Exercise

Click Next exercise to continue.