Using python, write code for problem. The text file Numbers.txt is used and i have put screenshot of data contained in the file. Please also put screenshot of your code.
Expert Answer
infile = open(“Numbers.txt”,’r’)
sum=0;
for line in infile:
sum=sum+int(line)
print (“The sum of the numbers in the file Numbers.txt is”,end=” “)
print (sum)
infile.close()
Screenshot of Code
Data in Numbers.txt:
1
2
4
5
5
6
OUTPUT: