Wednesday, 23 March 2016

Counting a string python

I'm a bit confused with the counting of a string that I would enter manually. I am basically trying to count the number of words and the number of characters without spaces. Also if it would be possible, who can help with counting the vowels?



This is all I have so far:



vowels = [ 'a','e','i','o','u','A','E','I','O','U']
constants= ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']


s= input ('Enter a Sentence: ')

print ('Your sentence is:', s)

print ('Number of Characters', len(s));

print ('Number of Vowels', s);

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...