Skip to content

Commit 315ce24

Browse files
committed
python file
1 parent 1e0c31c commit 315ce24

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Ass2.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class MyClass:
2+
3+
def __init__(self):
4+
with open("f1.txt","r") as f:
5+
global var1
6+
global var2
7+
var1 = f.readline()
8+
var2 = f.readline(2)
9+
def fun1(self):
10+
print( "Value of var1 is {} and var2 is {} ".format(var1,var2))
11+
12+
def fun2(self):
13+
global var2
14+
list = [2,4,6,8,10]
15+
list.append(int(var2))
16+
var2=sum(list)
17+
18+
19+
20+
object = MyClass()
21+
object.fun1()
22+
object.fun2()
23+
object.fun1()

0 commit comments

Comments
 (0)