QUESTION IMAGE
Question
complete the code.
import csv
infile = open(\one.txt\,
\)
outfile = open(\another.txt\,\w\)
myreader = csv.reader(infile)
for item in myreader:
aword = item0
anumber = float(item1) + 0.4
line = aword + \,\ + str(anumber) +
outfile.write(line)
Step1: Add a newline character
The code is writing to a text - file. To make each line separate in the output file, a newline character '
' should be added at the end of each line being written.
line = aWord + "," + str(aNumber) + '
'
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
line = aWord + "," + str(aNumber) + '
'