-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject45.py
70 lines (29 loc) · 840 Bytes
/
project45.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
class student:
school = "MGGHS"
def __init__(self,m1,m2,m3):
self.m1 = m1
self.m2 = m2
self.m3 = m3
def avg(self): #instance method(2 types)
return (self.m1+self.m2+self.m3)/3
def get_m1(self): #1.accessors
return self.m1
def set_m1(self,value): #2.mutators
self.m1 = value
@classmethod
def getSchool(cls):
return cls.school
@staticmethod
def info():
return "This is my class. Do whatever you want."
s1 = student(12,34,56)
s2 = student(34,56,78)
print(s1.avg())
print(s2.avg())
print(s1.get_m1())
s1.set_m1(58)
print(s1.get_m1())
print(s1.avg())
print(s2.avg())
print(student.getSchool())
print(student.info())