a program to accept a string and count no. of vowels ,consonent and spaces in the string and also find out the no. of words in it
Answers
Answered by
2
this is the program to input a string and display the total number of vowels present in it.
Attachments:
abhishek330negi2000:
thnkss a lot once again...i will pay my dept one day... be active for my more problems
Answered by
3
string = input("Enter a string: ")
cv = 0
for i in string:
if i in "AEIOUaeiou":
cv = cv + 1
cc = 0
for i in string:
if i not in "AEIOUaeiou":
cc = cc + 1
cs = 0
for i in string:
if i == " ":
cs = cs + 1
cw = 0
for i in string.split():
cw = cw + 1
print("Vowels: ", cv)
print("Consonants: ", cc)
print("Spaces: ", cs)
print("Words: ", cw)
Attachments:
Similar questions
Math,
7 months ago
Computer Science,
7 months ago
English,
7 months ago
Science,
1 year ago
Geography,
1 year ago