Write a function that counts all the characters and the vowels in a string the user inputs. Then write a routine that calls the function and displays the following output.
$ ./count_all.py
Enter some words: The sun rises in the East and sets in the West.
13 letters in 47 are vowels.
$ cat count_all.py
#!/usr/bin/python
def countAll(my_string):
vowelCount = totalCount = 0
for s in my_string:
if s.lower() in 'aeiou':
vowelCount += 1
totalCount += 1
return vowelCount, totalCount
stg = raw_input('Enter some words: ')
vowelCount, totalCount = countAll(stg)
print vowelCount, 'letters in', totalCount, 'are vowels.'
You might also like to view...
When someone's personal information is compromised and the information is used to impersonate the victim and gain access to their funds, ________ has taken place
Fill in the blank(s) with correct word
What should be done before any changes are made to a system that is experiencing a problem?
A. Examine the system B. Backup data C. Establish a Theory D. Test your Theory
Although many different styles of documentation exist for report preparation, each style requires the same basic information.
Answer the following statement true (T) or false (F)
In an array, an index value begins at zero while a subscript begins at 1
Indicate whether the statement is true or false