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]
3 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]3 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
If she lifts the bar 10 times in 20 seconds how much power did she save
MariettaO [177]
The answer to your question is she has 10 power lift
6 0
3 years ago
Chris wants to view a travel blog her friend just created. Which tool will she use?
wolverine [178]

Answer:

Web browser

Explanation:

7 0
3 years ago
Why Use LinkedIn AI Automation Tools to Grow Your Sales Pipeline?
guajiro [1.7K]

Answer:

With more than 722 million prospects on this platform, there’s a huge potential to find your next set of qualified leads.

  • More than 89% of the B2B marketers are already using LinkedIn to scale their lead generation efforts.
  • Almost 62% of them admit that LinkedIn has helped them to generate 2X more leads than any other social channels.
  • Almost 49% of the B2B marketers are using LinkedIn AI automation tools to find their future customers easily.
  • Also, more than half of the B2B buyers are on LinkedIn to make their buying decisions. This means that your ideal future leads are on LinkedIn making it a perfect platform for your business.  

That’s part of the reason why LinkedIn is one of the favorite platforms to generate B2B leads.

7 0
3 years ago
PLS ANSWER ASAP!!!! <br><br> In three to five sentences, explain the function of utilities.
il63 [147K]

Answer:

In economics, utility function is an important concept that measures preferences over a set of goods and services. Utility represents the satisfaction that consumers receive for choosing and consuming a product or service.  Utility function is widely used in the rational choice theory to analyze human behavior.

Explanation:

7 0
3 years ago
In this activity, you will create a Portable Document Format (PDF) version of a photography career résumé. You will include all
Troyanec [42]

Answer:

Use Adobe Acrobat or another software that enables you to create a PDF.

Explanation:

Download Adobe Acrobat from the official website.

Once you've installed the software, follow the instructions of your assignment. A good example of a resume for a photography career can be found through a web search, any should do.

Once you've opened up the program, you'll find the tools in the toolbar to help you organize the resume however you'd like it to look. It doesn't matter how you structure the resume, what matters is that you include all of the necessary information asked of you for your assignment.

You can look up important details that should be included in your resume online through a web search.

I hope this helps! And good luck!

4 0
2 years ago
Other questions:
  • What line of code will import matplotlib in it
    10·1 answer
  • Every file on a storage device has a _______. (a.) name (b.) size (c.)both of the above (d.) none of the above
    10·1 answer
  • Count characters Write a program whose input is a string which contains a character and a phrase, and whose output indicates the
    6·1 answer
  • Which function returns a valid value without any arguments?
    14·2 answers
  • What settings are available in the Properties dialog box of a message? Check all that apply.
    6·2 answers
  • ⚠️⚠️⚠️⚠️⚠️⚠️Help! What is not an advantage of using virtual machines?
    14·1 answer
  • Key Categories: more libraries and thousands of functions
    5·1 answer
  • What is the maximum number of characters you can have in a file name​
    8·1 answer
  • Please help me solve am wai...​
    11·1 answer
  • What is the grade, as a percentage with two digits after the decimal point, obtained when you graded this 101-question multiple-
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!