Set 138 Practical Question

⭐ Q40. एक sentence में words, capital, small, special symbols count करें

Example Code (Read Only):


s = input("Enter sentence: ")
words = len(s.split())
capital = sum(1 for c in s if c.isupper())
small = sum(1 for c in s if c.islower())
special = sum(1 for c in s if not c.isalnum() and c!=" ")

Python Online Editor