0% found this document useful (0 votes)
10 views1 page

String Character Counter in Python

Uploaded by

kuttysanju385
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

String Character Counter in Python

Uploaded by

kuttysanju385
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

class String:

def __init__(self):
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = " "
def getstr(self):
[Link] = input("Enter a string: ")
def count(self):
vowels = "AEIOUaeiou"
for ch in [Link]:
if ([Link]()):
[Link] += 1
if ([Link]()):
[Link] += 1
if (ch in vowels):
[Link] += 1
if (ch == " "):
[Link] += 1
[Link] = ([Link] + [Link]) - [Link]
def display(self):
print("The given string contains...")
print("{} Uppercase letters".format([Link]))
print("{} Lowercase letters".format([Link]))
print("{} Vowels".format([Link]))
print("{} Consonants".format([Link]))
print("{} Spaces".format([Link]))
S = String()
[Link]()
[Link]()
[Link]()

You might also like