check if it contains only vowels. Using Python
Posted on | Wednesday 17 May 2023 | No Comments
Given a string, check if it contains only vowels.
Input Format
Input contains a string S, consisting of lowercase and uppercase characters.
Constraints
1 <= len(S) <= 100
Output Format
Print "Yes" if string contains only vowels, "No" Otherwise.
Sample Input 0
SmartInterviews
Sample Output 0
No
vcount = 0;
ccount = 0;
str = input()
str = str.lower();
for i in range(0,len(str)):
if str[i] in ('a',"e","i","o","u"):
vcount = vcount + 1;
elif (str[i] >= 'a' and str[i] <= 'z'):
ccount = ccount + 1;
if ccount==0:
print("Yes")
else :
print("No")
Comments
Categories
Archives
- May 2023 (30)
Leave a Reply