Skip to content

Instantly share code, notes, and snippets.

@ronreiter
Created March 14, 2017 20:07
Show Gist options
  • Save ronreiter/df41522ba03839fa8fb86a55b74793b9 to your computer and use it in GitHub Desktop.
Save ronreiter/df41522ba03839fa8fb86a55b74793b9 to your computer and use it in GitHub Desktop.
Longest word in Hebrew
a = open("/Users/Ron/words.txt").read().decode("utf8").split()
first_row = ["ק", "ר", "א", "ט", "ו", "ן", "ם", "פ"]
second_row = ["ש", "ד", "ג", "כ", "ע", "י", "ח", "ל", "ך", "ף"]
third_row = ["ז", "ס", "ב", "ה", "נ", "מ", "צ", "ת", "ץ"]
first_row = [x.decode("utf8") for x in first_row]
second_row = [x.decode("utf8") for x in second_row]
third_row = [x.decode("utf8") for x in third_row]
only_first = sorted([(len(x), x) for x in a if all(y in first_row for y in x)])
only_second = sorted([(len(x), x) for x in a if all(y in second_row for y in x)])
only_third = sorted([(len(x), x) for x in a if all(y in third_row for y in x)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment