Answer:
The solution code is written in Python 3
1. output = ""
2. with open("text1.txt") as file:
3. data = file.readlines()
4.
5. for r in data:
6. output += r.upper()
7.
8. with open("text2.txt", "w") as file:
9. file.write(output)
Explanation:
Firstly, let's ready a variable output to hold the read data from the first text file (Line 1).
Next, use open function to create a file stream object and use its readlines() method to read all rows of data from text1 (Line 2 -3)
Next create a for loop to traverse through every row of the read data and use upper() function to change all characters in the current row to uppercase and append it to output variable.
Once the entire output string is ready, use open function again to create a file stream object but add "w" as second parameter of the open function (Line 8).
Lastly, use write method to copy the uppercase text held by the output variable, to the new file, text2 (Line 9).