Python exercises
1. Write a program which returns the number of uppercase letters, lowercase letters,
and other kinds of letters in the string input by the user.
2. Write a program which asks user to input a string, then return a dictionary (keys are
distinct letters of the string, values are the number of occurrences of each letter)
3. Write a program which asks user to input a name, then rewrite the name correctly
(The first characters of every word are uppercase, other characters are lowercase).
Example: Input “do tHuy duONG” Do Thuy Duong
4. Write a program which asks user to input a verb, then return the corresponding
gerund (verb-ing), following the rule:
a. You have the option to add the “ing” at the end of the verb and make it a
gerund. Example: cry, “+ing” = crying
b. Remove the “e” from the verb where it comes at the end and add the
“ing.” Example: ride, “-e”, “+ing” = riding
c. Eliminate the “ie” from the verb where it comes at an end and add the “y”
and then “ing.” Example: lie, “-ie”, “+ing” = lying
d. Keep the “ee” from the verb when it comes with “ee” at the end and add the
“ing.” Example: agree, “+ing” = agreeing
e. For monosyllabic words with a consonant-vowel-consonant format, doubling
the final letter and appending “ing” at the end is a suitable
approach. Example: cut, “t”, “+ing” = cutting
f. Adding the “ing” at the end of the monosyllabic verb with
consonant_vowel_consonant format, and the last word has less speaking
importance. Example: shift, “t” “+ing” = shifting
5. Write a program which asks user to input a string and a sub-string, then find the
positions of all occurences of the sub-string in the string.
6. Write a program which asks users to remove any duplicate in the string input by
users.
7. Write a program which asks users to input a list of words seperated by a comma,
then return a new list containing no duplicate words and sort words ascendingly
based on alphabetical order. Example: “red, white, black, red, green, black”
output: “black, green, red, white”
8. Write a program which asks users to input a string in the form “dd-mm-yyy”, print
this string using words. Example: “02-12-2020” The second of December,
twenty twenty.