-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauxilia.py
More file actions
31 lines (27 loc) · 787 Bytes
/
auxilia.py
File metadata and controls
31 lines (27 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def all_letters_greek(word):
"""
given word, check if all letters are greek
:return:
"""
range_of_greek_letters = range(900, 988)
for letter in word:
if letter != ' ':
if ord(letter) not in range_of_greek_letters:
return False
return True
def all_letters_latin(word):
"""
given word, check if all letters are latin
:return:
"""
range_of_latin_letters = range(0, 126)
if any(ord(letter) not in range_of_latin_letters for letter in word):
return False
return True
def some_letters_non_greek(word):
"""
True only if 1 or 2 letters are not greek and the string is longer > 4
"""
if any(ord(l) not in range(900, 988) for l in word):
return True
return False