Understanding string functions.
isalnum() - returns True if character is alphabet or number.
in a string, returns True if string contains only letters and alphabets.
returns False if string contains special characters.
string="abg1234".isalnum() #returns True
string="abg12@#$34".isalnum() #returns False
isalpha() - returns True if character is an alphabet.
isdigit() - returns True if character is a number.
islower() - returns True if character is a lower case alphabet.
isupper() - returns True if character is a upper case alphabet.
Input Format
A single line containing a string
Output Format
In the first line, print True if string has any alphanumeric characters. Otherwise, print False.
In the second line, print True if string has any alphabetical characters. Otherwise, print False.
In the third line, print True if string has any digits.Otherwise, print False.
In the fourth line, print True if string has any lowercase characters. Otherwise, print False.
In the fifth line, print True if string has any uppercase characters. Otherwise, print False.
Sample Input:
qA2
Sample Output:
True
True
True
True
True
Solution:
No comments:
Post a Comment