Python offers 4 methods that are useful to change the case of a string. They are upper(), lower(), swapcase(), title(). The upper() method is used to convert all the characters of a string into uppercase or capital letters. The lower() method converts the string into lowercase or into small letters. The swapcase() method converts the capital letters into small letters and vice versa. The title() method converts the string such that each word in the string will start with a capital letter and remaining will be small letters.
The startswith() method is useful to know whether a string is starting with a sub string or not. The way to use this method is:
When the sub string is found in the main string 'str', this method returns True. If the sub string is not found, it returns False. Consider the following statements:
Similarly, to check the ending of a string, we can use endswith() method. It returns True if the string ends with the specified sub string, otherwise it returns False.