Skip to content

Instantly share code, notes, and snippets.

@raibima
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save raibima/baf6320924f398b50934 to your computer and use it in GitHub Desktop.

Select an option

Save raibima/baf6320924f398b50934 to your computer and use it in GitHub Desktop.
Tutorial Eva
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