Instruction
Well done! It's time to wrap things up.
len()returns the string length.index(substr)andfind(substr)return the index of the first occurrence ofsubstr. If the substring is not found,index()raises aValueError, andfind()returns-1.count(substr)counts the number of occurrences ofsubstrin a given string.isdigit()checks if any string characters are digits. For other is-functions, please see the Python documentation.str.isalpha()returnsTrueif all characters in the string are letters.str.isalnum()returnsTrueif all characters in the string are letters or digits.str.isspace()returnsTrueif all characters in the string are whitespace characters.str.islower()andstr.isupper()returnTrueif all characters in the string are lowercase or uppercase, respectively.startswith(substr)andendswith(substr)check if the string begins or ends with substr, respectively.upper(),lower(), andcapitalize()are used to change the case of letters in a string.strip(),lstrip(), andrstrip()are used to get rid of unnecessary characters at the beginning and/or end of a string.replace(old, new)replaces all instances ofoldwithnew.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 to continue.



