. Write a python program that reads a line ( as a string sequence ) and prints the following:
(i) No. of lowercase alphabets
(ii) No. of uppercase alphabets
(iii) No. of digits
Answers
Answered by
3
string = input("Enter a string: ")
lower = 0
upper = 0
number = 0
for char in string:
if char >= "a" and char <= "z" and char.isnumeric() != True:
lower += 1
if char >= "A" and char <= "Z" and char.isnumeric() != True:
upper += 1
if char.isnumeric():
number += 1
print(f"lower: {lower}\nupper: {upper}\nnumber: {number}")
Similar questions