Skip to content

Commit 2c02bdf

Browse files
committed
Python
1 parent 145c20a commit 2c02bdf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

day45(static).py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Math:
2+
def __init__(self, num):
3+
self.num = num
4+
5+
def addtonum(self, n):
6+
self.num = self.num +n
7+
8+
@staticmethod
9+
def add(a, b):
10+
return a + b
11+
12+
# result = Math.add(1, 2)
13+
# print(result) # Output: 3
14+
a = Math(5)
15+
print(a.num)
16+
a.addtonum(6)
17+
print(a.num)
18+
19+
print(Math.add(7, 2))

0 commit comments

Comments
 (0)