Question: Write a Python function that copies one file into another, omitting any lines that begin with #. Example. The original file: Lab10tbd ! #Christo Dichev

Write a Python function that copies one file into another, omitting any lines that begin with #. Example. The original file: Lab10tbd ! #Christo Dichev Lab 10 3 def negative Seq (List): temp Pos [ ] tempNeg = [] 5 6 #Seperating the negative and positive values into seperate list 7 for number in List: if number >= 0: 9 10 tempPos.append (number) else: tempNeg.append (number) 12 #Sorting both reverse and forward 13 14 15 16 17 #Concadenating the lists together 18 19 20 tempPos.sort () tempNeg.sort (reverseTrue) sprint (tempPos) for debugging #print (tempNeg) finalist tempNeg + tempPo3 return finalList The filtered file: Lab 10Fitered todt X 1 2 def negative Seq (List) 3 temp Pos = [] tempNeg[] for number in List: 5 6 7 8 9 10 if number >= 0: tempPos.append (number) else: tempNeg.append (number) 12 13 14 15 16 tempPos.sort () tempNeg.sort (reverse = True) #print (tempPos) for debugging #print (tempNeg) fina!List tempNeg + tempPos return finalList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
