In: Computer Science
In python idle 3.9.0 write a function that:
i) will count all lower case, upper case, integers, and special symbols from a given string. The input string is provided by the user.
ii) will check if a sting is a palindrome. User supplies the input string.
OUTPUT:
def function(string):
#initilaize values with 0
lower_case=0
upper_case=0
integers=0
special_chars=0
#special chars list
special_characters ="!@#$%^&*()-+?_=,<>/\""
for ch in string:
#if char is lower
if ch.islower():
lower_case+=1
#if char is upper
if ch.isupper():
upper_case+=1
#if it is a digit
if ch.isdigit():
integers+=1
#if it in special_characters increment special_chars
if ch in special_characters:
special_chars+=1
#print it
print(lower_case,upper_case,integers,special_chars)
s=input('Enter a string:')
function(s)
comment if any doubts