1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Paraphin [41]
4 years ago
13

Write a program that asks the user for the names of two files. The first file should be opened for reading and the second file s

hould be opened for writing. The program should read the contents of the first file, change all characters to uppercase, and store the results in the second file. The second file will be a copy of the first file, except that all the characters will be uppercase. Use Notepad or another text editor to create a simple file that can be used to test the program.
Computers and Technology
1 answer:
Luda [366]4 years ago
4 0

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).

You might be interested in
It is important to consider the quality of the data being used when considering the accuracy of a conclusion. Incorrectly collec
frosja888 [35]

Answer:

b) \:  \: The  \: location \:  of \:  a  \: major  \: sports \: franchise.

8 0
3 years ago
Read 2 more answers
central, secure database in which Windows stores hardware and software configuration information and system security policies is
Ilya [14]

Answer:

The Registry

Explanation:

The registry is a centralized and secure database whereby Windows stores the overall configuration information of the hardware including the configuration information of the software as well as the system security policies. The Components that make use of the registry include the device drivers, Windows kernel, hardware profiles, setup programs, and user profiles.

8 0
3 years ago
Which command on the page layout ribbon enables a user to mark where a new page will begin on the printed copy?
tatiyna
The page break is the command on the page layout ribbon enables a user to mark where a new page will begin on the printed copy
3 0
3 years ago
If a small monster collector has 20 small monster containment devices; intends to use all of those devices; has access to non-un
-Dominant- [34]

The collector can capture nine different types of combinations of monster types.

<u>Explanation</u>:

  • There are twenty small monster containment devices. The collector has access only to non-unique types. They are water, fire and grass types of small monsters.
  • The collector will capture at least two of the small monsters of each type. So he will capture two types of water, two types of fire and two types of grass. After that, he will capture three different types of fire monsters.
  • So he will capture nine different types of monsters.
3 0
3 years ago
Choose the response that best completes the following statement.
Soloha48 [4]

Answer:

probably the 5 second pause

7 0
3 years ago
Read 2 more answers
Other questions:
  • If you could make any blog, what would it be about and why?
    9·1 answer
  • Under the advanced options screen, what startup option should be enabled in order to view what did and did not load during the b
    12·1 answer
  • In which step of web design is storyboarding helpful?
    14·1 answer
  • (True/False). If the definition of an IS is the medium for recording and storing data, and disseminating information, this would
    12·2 answers
  • What is related to Gamut in Adobe illustrator?
    8·1 answer
  • SONET: is a standard for optical transmission that currently operates at Terabit per second speeds is almost identical to the IT
    7·1 answer
  • Write a program that creates an integer array with 40 elements in it. Use a for loop to assign values to each element of the arr
    5·1 answer
  • In a sport like baseball, which of the following could be considered a “rule”?
    12·1 answer
  • Write a code segment that uses a loop to create and place nine labels into a 3-by-3 grid. The text of each label should be its c
    6·1 answer
  • What is game development​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!