0
How can we count the 'alphabets' in a string
10 Respostas
+ 6
Like this?
https://code.sololearn.com/co9SLniVB2f5
+ 5
dunno about other codes here but it looks a bit dirty or overly complex.
here's my implementation
string = "abracadabra"
length = len([i for i in string if i.isalpha()])
print(length)
+ 1
Thanks mirielle, that's exactly what I needed
+ 1
Thanks EVERYONE for your help, I will never forget it😃😃
0
Can you please explain it with an example?
0
What I am trying to ask is, so suppose
X=['anystring']
Print(number of alphabets in it)
In this case the alphabets are 9
0
Similar, I want 5+2+2+1+1
in Abracadabra, the total alphabets are 11
0
this is the most simple i can come up with :
def count(word):
n = len(word)
return (n)
y = count('rainbowxyz')
print(y)
- 1
alpha = "alphabets"
count = lenght(alpha)
print(count)