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
E-mail is an efficient means of disseminating information quickly and inexpensively. However, HIPAA regulations affect e-mail us
oksano4ka [1.4K]

Sending potentially sensitive information by email

Potentially sensitive information can be sent via Email only if the Email is encrypted

Explanation:

No doubt Email is an inexpensive efficient means of communicating quickly. But it is prone to hacking and it is not a secure mechanism. In order to add security ,the Email needs to be sent in an encrypted form. Banking and HIPAA regulations require the emails to be sent in encrypted form as it is a secure mechanism. Even if one has the consent from the client , the Email has to be in encrypted. Even if the Organization's e-mail system has appropriate firewalls and related infrastructure , the golden rule is to send encrypted format Emails.

7 0
4 years ago
An app builder has created a report for sales people to view records from the custom object, some users have complained that the
a_sh-v [17]

Answer:

Check sharing rules

Check organization-wide defaults

Check the user s profile for object settings

Explanation:

There is a need for some people to see the total transparency of the records that are meant to be shared with a select group of people. There are certain things that can be done for this. The first one is that the sharing rules should be checked. To whom are the details shared with. The next one is the filters that are used.

These can be reported and changed accordingly. Lastly, the whole organization’s defaults can be checked. This is something that can be done when the previous methods that were done did not work that well. Once some changes are done, the people can check if they already work and if the records can be viewed.

6 0
4 years ago
In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the
rusak2 [61]

Answer:

Explanation:

def the_perfect(n):

  try: #exception handling if n is a negative number

       n > 0

   except: #return -1 if the error is reached

       return -1

  else:

        total = 0

        for i in range(1, n): #for loop from 1 to the target number

           if n % i == 0:

               total += i

   return total == n  #should return true if number is perfect number

print(perfect_number(8))

8 0
3 years ago
Write down the pseudo code for a brute-force algorithm to compare elements in array A with elements in array B.
Thepotemich [5.8K]

Answer:

def brute_force(array1, array2):

   for item in array1:

       for element in array 2:

           if element == item:

               print(f"{element} and {item} are a match")

Explanation:

A brute-force algorithm is a direct-to-solution algorithm that searches and compares variables. It is like trying to unlock a safe but not knowing its four-digit combination, brute-force starts from 0000 through 9999 to get a match.

The python program implements the algorithm using two nested for loops. The first loop iterates over array1 while the second, over array2. For every item in the first array, the program loops through the length of the second array. For every match, the items are printed on the screen.

5 0
3 years ago
With what for a human may a heatsink in the computer be compared? a crispy lettuce salad an ice cold drink of water a sizzling s
Marysya12 [62]

Answer: I'd say an ice cold drink

7 0
4 years ago
Other questions:
  • Consider the following method intended to modify the parameter names by removing all instances of the String n.
    14·1 answer
  • Can i uninstall adobe lightroom 6 and reinstall
    13·1 answer
  • What is an example of asynchronous communication
    7·1 answer
  • Using a "word" of 3 bits, list all of the possible signed binary numbers and their decimal equivalents that are representable in
    11·1 answer
  • Which biometric technique is considered nearly infallible from a scientific point of view and is increasingly preferred by crimi
    8·1 answer
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    9·1 answer
  • Programmers compile a list of instructions to build their applications. These instructions are typically grouped into units of c
    10·1 answer
  • Which of the following lists contains the five essential elements of a computer? Group of answer choices: 1. inputs, returns, pr
    11·1 answer
  • Which key is used to indent the first line of a paragraph to the right?
    15·2 answers
  • One interesting application of two-dimensional arrays is magic squares. A magic square is a square matrix in which the sum of ev
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!