Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

complete the code. import csv infile = open(\one.txt\, \) outfile = ope…

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)

Explanation:

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) + '
'

Answer:

line = aWord + "," + str(aNumber) + '
'