I don't know how to read input array number in input.txt and write result in output.txt.
Example:
input.txt have array 7 8 9 2
write result sort in output.txt 2 7 8 9
How can I do it?
I don't know how to read input array number in input.txt and write result in output.txt.
Example:
input.txt have array 7 8 9 2
write result sort in output.txt 2 7 8 9
How can I do it?
Suppose input is in input.txt and you want output in output.txt. Make a python script and name it sort.py like this:
l=map(int,raw_input("").strip().split())
l.sort()
print l # It will store it as a list
# or more precisely your answer can be
k=""
for i in l:
k+=str(i)+" "
print k #same output as you want
Run it in the terminal :
python sort.py < input.txt > output.txt