consonant
Problem Description
Write a Python program to get the string input from the user and find the number of consonant
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output.
CODING ARENA
def count_vowels_consonants(text):
vowels_list = ['A', 'E', 'I', 'O', 'U']
consonants = 0
vowels = 0
for character in text:
if character.isalpha():
if character.upper() in vowels_list:
vowels += 1
else:
consonants += 1
return (consonants)
a=input()
print(count_vowels_consonants(a))
Test Case 1
Input (stdin)eLabAutoEvaluationTool
Expected Output
9
Test Case 2
Input (stdin)trianglehasthreesides
Expected Output
13
No comments:
Post a Comment