-
Notifications
You must be signed in to change notification settings - Fork 1
/
modifythearray.py
37 lines (33 loc) · 969 Bytes
/
modifythearray.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
def main():
arrayintegers = raw_input("")
thearray = [int(x) for x in arrayintegers.split(',')]
inodes = int(raw_input(""))
jnodes = int(raw_input(""))
reset=0
index = 0
indextoremove=[]
outstr =''
while index in range(len(thearray)):
if index>= reset + inodes:
if index <= reset+inodes+jnodes-1:
indextoremove.append(index)
if index == reset+inodes+jnodes:
reset = index
#print(reset)
index+=1
#print(indextoremove)
called=0
for indexes in indextoremove:
if called ==0:
thearray.pop(indexes)
else:
thearray.pop(indexes-called)
called+=1
for index in range(len(thearray)):
if not(index == len(thearray)-1):
outstr += str(thearray[index]) + ','
else:
outstr += str(thearray[index])
print(outstr)
if __name__ == "__main__":
main()