-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py~
More file actions
44 lines (38 loc) · 947 Bytes
/
Copy pathmain.py~
File metadata and controls
44 lines (38 loc) · 947 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
32
33
34
35
36
37
38
39
40
41
42
43
44
import numpy as np
import codecs
from string import ascii_letters
import operator
def open(file):
count = 0
diff = []
my_set = []
my_charact = {}
with codecs.open(file,"rt",encoding="utf8") as my_file:
for line in my_file:
line= line.strip() # remove the \n
mots = line.split(" ")
my_set.append("")
for s in line:
if(s in ascii_letters):
if(my_charact .has_key(s)):
my_charact [s] += 1
else:
my_charact [s] = 1
for s in mots:
if(not(s in diff)):
diff.append(s)
if(len(my_set[count])<len(s)):
my_set[count] = s
count += 1
print "mots differents" , len(diff)
for s in range(len(my_set)):
print "Number de ligne {0} et mots : {1}".format(s,my_set[s])
print count
sortes(my_charact)
lst = [1,5,8,7,2]
print "moyenne : " , moyenne(lst)
print "variance :" , variance(lst)
print {'ezlke' :12,'klkl' : 25}
authors = ["S", "C" , "B","S","S"]
nb(authors)
open("english.txt")