Tuesday 28 May 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...