Calculate the sum of the squares of numbers from 1 to 30. The squares of the numbers are written in the file.
The 3 part problem
Need to:
- open file
- read file
- each square of the number is added to the sum
close file
f=open('text1.txt','r') st = f.read() S=0 for str1 in f: for i in range(1,30) S=S+i print("S=",S) f.close()
readmethod of the files - andreymal