In Python, we can check strings if we they contain few characters. These characters can include numbers, lower case, upper case, both numbers and alphabets. To achieve this, we use:
string.isCondition()
string.isdigit()
This function lets us to check if a string contains numbers.
>>>'123'.isdigit()
True
Because the string 'ABC123' has numbers, which are 123, this function returns us with a boolean operator called, 'True' conveying that there are numbers in the string.
In the same way, we can check if all the characters in the string are upper or lower case.
>>> 'abc'.islower()
True
>>> 'ABC'.isupper()
True
Using string.isalpha() to check if the string contains all alphabets and we can use string.isalnum() to check if the string contains a combination of letters and numbers.
>>> 'abC'.isalpha()
True
>>> 'aBc123'.isalnum()
True