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...
Match the following chart elements with their descriptions:
I. plot area II. chart area III. data points IV. data series V. multiseries A. cells that contain numeric values B. area representing the data C. contains data points that represent a set of related numbers D. the chart and all of its elements E. data for two or more sets of data
To show the hierarchical structure of a business, you would choose a(n) ________ SmartArt graphic
A) vertical bulleted list B) organizational chart C) segmented process D) stacked list