In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 9th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #05 exercise sheet]
In this problem you should submit a function as described. Inside the function do not print anything that was not asked!
Just as you finished impressing the Mad Hatter, you heard a faint creak. Turning around, you saw the Doorknob slowly twisting and turning, yawning as he woke from a long nap. With his sleepy, yet curious eyes fixed on you, he spoke:
Write a function count(word, letters) that given a string word and a string letters indicating the set of important characters, returns the amount of characters in word that are present also in letters.
For instance, the call count("madame", "aeiou") should return 3, as there are 3 characters in "madame" (two 'a's and one 'e') that also appear in "aeiou".
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ |word| ≤ 100 | size of input word | |
1 ≤ |letters| ≤ 100 | size of string containing the characters to count |
Example Function Calls | Example Output |
print(count("madame", "aeiou")) print(count("1forty40two2", "0123456789")) print(count("introduction to programming", "prt")) |
3 4 7 |