-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·55 lines (35 loc) · 997 Bytes
/
Copy pathtest.py
File metadata and controls
executable file
·55 lines (35 loc) · 997 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
45
46
47
48
49
50
51
52
53
54
55
class Block:
def __init__(self):
self.block = [None]*800 #each element will be either 0 or 1
class DiskA:
def __init__(self):
self.disk = [Block() for i in range(200)]
class DiskB:
def __init__(self):
self.disk = [Block() for i in range(300)]
def API_for_write(block_No, data):
if(block_No <= 200):
#read and write from diska
diska.disk[block_No-1] = data
print diska.disk[block_No-1]
# print diska
else:
#read and write from diskb
diskb.disk[block_No-201] = data
print diskb.disk[block_No-201]
def API_for_read(block_No):
if(block_No <= 200):
#read and write from diska
return diska.disk[block_No-1]
# print diska
else:
#read and write from diskb
return diskb.disk[block_No-201]
diska = DiskA()
diskb = DiskB()
API_for_write(1 , "mamm")
API_for_write(200, "ww")
print API_for_read(88)
# print diska.disk
# s = stru()
# s.a = 10