-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClass.py
86 lines (60 loc) · 2.28 KB
/
Class.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import csv
from statistics import mean
l=["A","B"]
ll=["sen","ghad","vazn"]
class school:
count=0
def __init__(self,namecelas,students):
self.namecelas=namecelas
self.students=students
school.count+=1
def get_names(self):
return ("celase %s" %self.namecelas)
def get_students(self):
return ("celase %s, %i danesh amooz darad" %(self.namecelas,self.students))
def tedade_celasha(self):
return ('I have %i classes' %school.count)
class celas(school):
def miangin(self):
l=["A","B"]
compare_list=list()
for letter in l:
with open("E:\\Python project\\advanced python jadi\\tamrin1\\%s.csv" %(letter), "r") as f:
reader=csv.reader(f)
for row in reader:
w=list()
for i in row:
w.append(float(i))
compare_list.append(float(mean(w)))
print(float(mean(w)))
#print(compare_list)
f.close()
if compare_list[1]>compare_list[-2]:
return "A"
elif compare_list[1]==compare_list[-2]:
if compare_list[2]<compare_list[-1]:
return "A"
elif compare_list[2]==compare_list[-1]:
return 'Same'
else:
return 'B'
else:
return "B"
for letter in l:
a=int(input("tedade danesh amoozane kelase %s ra vared konid " %letter))
with open("E:\\Python project\\advanced python jadi\\tamrin1\\%s.csv" %letter,"w",newline="") as x:
writer=csv.writer(x)
for ii in ll:
detail=input("%s danesh amoozan ra vared konid " %ii)
b=detail.split()
bb=[]
for iii in b:
bb.append(float(iii)) #to save float as a list member
writer.writerow(bb)
x.close()
qqq=str(a) #bcz we want to define a class and the name of it should be a variable not a "str" or "int"
qqq=school('%s' %letter,a)
#print(qqq.get_names())
#print(qqq.get_students())
#print(qqq.tedade_celasha())
print(celas.miangin(5))