-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelements.py
More file actions
executable file
·29 lines (24 loc) · 835 Bytes
/
elements.py
File metadata and controls
executable file
·29 lines (24 loc) · 835 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
#!/usr/bin/env python3
import random
class Elements():
def import_lines(self, fh, n = 99999):
return [line.rstrip().split(" ") for line in fh.readlines()]
def check(self, e):
data_given = random.randint(0, 2)
success = True
print(e[data_given])
for i in range(0, 4):
if i == data_given:
continue
if standardized(input()) != standardized(str(e[i])):
print("On attendait", e[i])
success = False
return success
import re
def standardized(string):
string = string.lower()
specialChars = {"e": "éèê", "o": "ô", "a": "àâ", " ": "-_’'"}
for simple, complexes in specialChars.items():
for complex in complexes:
string = re.sub(complex, simple, string)
return string