Last active
August 29, 2015 14:17
-
-
Save raibima/baf6320924f398b50934 to your computer and use it in GitHub Desktop.
Tutorial Eva
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def occurrences(text1, text2): | |
| result = 0 | |
| unique_characters = [] | |
| # for every character in text1 | |
| for character in text1: | |
| # check whether or not the character has been encountered before | |
| if character not in unique_characters: | |
| # if not, add that character to the list | |
| unique_characters.append(character) | |
| # for every character in text2 | |
| for char in text2: | |
| if char == character: | |
| result += 1 | |
| return result | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment