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
sergiy2304 [10]
2 years ago
12

Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method

Computers and Technology
1 answer:
weeeeeb [17]2 years ago
3 0

Using the computational language in python we have to use it to write to a file and read with the code.

<h3>Writing this code in python we have:</h3>

<em>filename = input()</em>

<em>file = open(filename)</em>

<em>lines = file.readlines()</em>

<em>data = {}</em>

<em>for i in range(0, len(lines), 2):</em>

<em>    num_seasons = int(lines[i].strip())</em>

<em>    show = lines[i + 1].strip()</em>

<em>    if num_seasons not in data:</em>

<em>        data[num_seasons] = []</em>

<em>    data[num_seasons].append(show)</em>

<em>file.close()</em>

<em>file_writer = open('output_keys.txt', 'w')</em>

<em>titles = []</em>

<em>for num_seasons in sorted(data):</em>

<em>    shows = []</em>

<em>    for show in sorted(data[num_seasons]):</em>

<em>        titles.append(show)</em>

<em>    file_writer.write(str(num_seasons) + ': ' + '; '.join(data[num_seasons]) + '\n')</em>

<em>file_writer.close()</em>

<em>file_writer = open('output_titles.txt', 'w')</em>

<em>for title in sorted(titles):</em>

<em>    file_writer.write(title + '\n')</em>

<em>file_writer.close()</em>

See more about python at brainly.com/question/18502436

#SPJ1

You might be interested in
Richard wants to create a cloud-based system that will be a centralized repository of log files from various servers in the orga
jeyben [28]

Answer:

CAD ( d )

Explanation:

Richard should use CAD to create a cloud-based system, since he wants it to be a centralized repository of log files to be taken from the different servers associated with the organization

CAD ; Computer aided design software is the best software to be used because files created using CAD can be easily stored in cloud and it is easily accessible.

4 0
3 years ago
An administrator needs to set up an authentication server for users connecting to a network through a VPN. What kind of server c
Leya [2.2K]

Answer:

RADIUS

Explanation:

The administrator needs to set up a RADIUS server for this particular example, RADIUS is a networking protocol, this protocol provides centralized Authentication, Authorization for users who connect and use a network service, this is an authentication remote service, and we can use it with the VPN  (virtual private networks).

7 0
3 years ago
Suppose your parents are planning to take you
Verdich [7]

Answer:

I think the answer would be a smartphone, hope this helps! Comment if I am wrong

4 0
3 years ago
Need help with understanding Project Reactor<br><br> https://projectreactor.io/
ddd [48]

Answer:

IT IS LIKE A ONILE AND THE PERFECT

Explanation:

THIS IS YOUR ANSWER

I HAVE EXPLAINED YOU

8 0
3 years ago
What is mouse and how many types of mouse are there​
bekas [8.4K]

Answer:

a mouse is the object that controls the cursor on your computer/laptop, there's one standard type of mouse, but there are thousands of makes and models.

Explanation:

3 0
3 years ago
Other questions:
  • The windows desktop contains a start button in its lower-right corner, which can be used to start the computer.
    14·1 answer
  • A card ____ is a device that reads data, instructions, and information stored on flash memory cards.
    8·1 answer
  • Denny often uses his word-processing program. Which of the following would Denny do to more easily access this program and incre
    14·2 answers
  • Order the following list of functions by the big-Oh notation. Group together those functions that are big θ of one another.6nlog
    5·1 answer
  • Draw an example of a binary tree that:
    11·1 answer
  • I need an answer and fast What happens if a sequence is out of order?
    5·2 answers
  • David is taking a test. To answer a question, he first covers up the answer choices. Next, he tries to answer the question. Then
    15·2 answers
  • Which type of service offers a preconfigured testing environment for application developers to create new software applications
    13·1 answer
  • "using this type of communications channel, several users can simultaneously use a single connection for high-speed data transfe
    12·1 answer
  • A ____ risk assessment evaluates threats to and vulnerabilities of the network.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!