Question: Copy the same read / looping code from # 1 or # 2 and then create a new file with each number higher by 1

Copy the same read/looping code from #1 or #2 and then create a new file with each number higher by 10(add ten to each number before writing it to a new file) in numbers.txt
The new file can have any name.
from ast import Return
from pickle import APPEND
file = open(google_drive_path + "numbers.txt","r")
lines =[]
new_file = open(google_drive_path + "newfile.txt","w")
for line in file:
lines.append(line.rstrip("}
(')
new_lines int line.rstrip )}
((n
for 1 in lines:
new_file.write "|n|
new_file.close()
file.close()
This is the code I have done so far and it outputs a new file but kept the same numbers from the original file instead of adding 10 to each number in the list
 Copy the same read/looping code from #1 or #2 and then

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!