Text file:
425 300 1
50 10 15
6 9 3
2 12 6
70 69 71
1 2 3
My code:
#Project#1-Quyen Nguyen
file="Project1.txt"
infile=open(file)
count=0
for line in infile:
strip_line=line.rstrip()
count=count+1
strip_line=line.split()
value0=strip_line[0]
value1=strip_line[1]
value2=strip_line[2]
numval0=int(value0,base=10)
numval1=int(value1,base=10)
numval2=int(value2,base=10)
print("line#,numval0,numval1,numval2)
I just take the class for 2 week and I am stuck with my HW. My question is how can i sort it in numerical order without using sort.
425 300 1
50 10 15
6 9 3
2 12 6
70 69 71
1 2 3
My code:
#Project#1-Quyen Nguyen
file="Project1.txt"
infile=open(file)
count=0
for line in infile:
strip_line=line.rstrip()
count=count+1
strip_line=line.split()
value0=strip_line[0]
value1=strip_line[1]
value2=strip_line[2]
numval0=int(value0,base=10)
numval1=int(value1,base=10)
numval2=int(value2,base=10)
print("line#,numval0,numval1,numval2)
I just take the class for 2 week and I am stuck with my HW. My question is how can i sort it in numerical order without using sort.