Letter count¶
Save all functions into the same file named count.py.
Write the function
count_up_low()that takes a text (string), and returns two intergers corresponding to the number of uppercase and lowercase letters in the text.See the following examples:
>>> count_up_low('ATENEA is the UPC Virtual Campus') (11, 16) >>> count_up_low("Barcelona, Paris, London ... I have to choose one.") (4, 32)
Note
More tests are provided in the
count1.txtfile.Write the function
vowels_perc()that takes a text (string), and returns the percentage of vowels with respect to the total number of characters in the text.See the following examples:
>>> round (vowels_perc ('Well done is better than well said'), 2) 29.41 >>> round (vowels_perc ("Once you choose hope, anything’s possible"), 2) 34.15 >>> round (vowels_perc ("If you have no critics you'll likely have no success"), 2) 32.69
Note
More tests are provided in the
count2.txtfile.
Solutions
A solution of these functions is provided in the
count.py file.