-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringd.py
More file actions
36 lines (36 loc) · 985 Bytes
/
Copy pathStringd.py
File metadata and controls
36 lines (36 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#q67as3python.py : Write a program in Python to input any sentence. Calculate and
#print (i) number of vowels, (ii) no of consonants, (iii) no of alphabets in that sentence.
def nvowel(s):
s1=s.upper() # To convert all alphabets to capital letters
nov=0 # nov=number of vowels
n=len(s)
for i in range(0,n):
ch=s1[i]
if(ch=='A' or ch=='E' or ch=='I' or ch=='O' or ch=='U'):
nov=nov+1
return nov
#End nvowel(s) function
def nalphabet(s):
s1=s.upper()
noa=0
n=len(s)
for i in range(0,n):
ch=s1[i]
if(ch>='A' and ch<='Z'):
noa=noa+1
return noa
#End of nalphabet(s) function
def nconsonant(s):
noc=nalphabet(s)-nvowel(s)
return noc
#End of nconsonant(s) function
#Main program starts
s=input("Enter any sentence=")
nv=nvowel(s)
nc=nconsonant(s)
na=nalphabet(s)
print("Your sentence=",s)
print("No of Vowels=",nv)
print("No of Consonants=",nc)
print("No of Alphabets=",na)
#End of main