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
Does a wizard function allow the user to enter or modify data in the records? select yes or no
mojhsa [17]
Yes wizard function allows you to modify records

4 0
3 years ago
The graph of a function f x is shown below what is the domain of f x​
patriot [66]
Was there supposed to be a picture here?
4 0
3 years ago
The Chairman of the Federal Reserve & the Federal Open Market Committee determine the percentage of a deposit which must be
Scrat [10]
Required Deposit Reserve
6 0
4 years ago
Jeff was explaining to a friend the importance of protecting a cryptographic key from cryptoanalysis. He said that the key shoul
Lisa [10]

Answer:

Jeff is describing confusion

Explanation:

In 1945, Claude Shannon gave a classified report on: "Mathematical Theory of Cryptography" where he stated that confusion and diffusion are two properties of the operation of a secure cipher which are very essential in cryptanalysis.

When each bit of the ciphertext depends on several parts of the key, secluding the connections between the ciphertext and the key, it is known as confusion.

Hence, Jeff saying that the key should not relate in a simple way to the cipher text describes confusion.

7 0
3 years ago
Which window allows you to view and change your computer's system information and settings?
ZanzabumX [31]
I think Its control panel
4 0
4 years ago
Read 2 more answers
Other questions:
  • which of the following is the term used for a set of programs that acts as an interface between the applications that are runnin
    7·1 answer
  • The use of public wireless connections can increase a user's vulnerability to monitoring and compromise. ____________ software c
    14·1 answer
  • Given input of a number, display that number of spaces followed by an asterisk. (1 point) Write your solution within the existin
    15·1 answer
  • Bethany is in her home, watching a video she took on vacation, while her brother is playing FIFA Soccer on his Xbox, and her dad
    7·1 answer
  • You need to buy a cable to connect a desktop PC to a router. Which cable should
    13·1 answer
  • If the user does NOT click the button what color will "topButton" be when this program finishes running?
    6·1 answer
  • Describing Lookup Fields
    14·2 answers
  • How are PivotCharts different from regular charts?
    12·1 answer
  • What is the CPU Unit of a computer?
    8·2 answers
  • Question 3 (5 points) ✔ Saved Janice is scrolling through her feed one day and notices that Abby said some awful things about Pa
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!