The picture shows the scenario and what I’m trying to achieve with my code.
gs = open("garagesales.txt", "r")
newFile = open("new.txt", "w")
newFileRecords = 0
for proLitSales in gs:
if float(proLitSales) > 100000:
newFile.write(proLitSales + "\n")
newFileRecords += 1
gs.close()
print("Total number of records written to newFile.txt is:", newFileRecords)
newFile.close()
newFile = open("new.txt", "r")
print(newFile.read())
newFile.close()
If someone can provide some corrections or examples that would be great, thanks.