Skip to content

Commit

Permalink
Python script added for manipulating list of long integers (#46)
Browse files Browse the repository at this point in the history
* Annotation block added for multiple service

* Import-es annotation removed

* Python script added for manipulating list of long integers
  • Loading branch information
danishjamal104 authored Mar 7, 2022
1 parent edd0404 commit 5ecc55b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Empty file added Utility/Python/in.txt
Empty file.
20 changes: 20 additions & 0 deletions Utility/Python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
data = []
with open('in.txt', 'r') as f:
for i in f.readlines():
data.append(int(i.replace("\n", "")))

new = []

for i in data:
new.append("\"{}\"".format(str(i+1)))
new.append("\"{}\"".format(str(i-1)))
new.append("\"{}\"".format(str(i+2)))
new.append("\"{}\"".format(str(i-2)))

with open('out.txt', 'w') as f:
for i in new:
f.write(i)
f.write(",\n")
for i in data:
f.write("\"{}\"".format(i))
f.write(",\n")

0 comments on commit 5ecc55b

Please sign in to comment.