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
Setler79 [48]
3 years ago
13

Write a program that asks the user for the name of a file. The program should display the contents of the file with each line pr

eceded with a line number followed by a colon. The line numbering should start at 1. (You can create a file and populate it with some data, then run your program to open that file and display the contents line by line with the number of the line preceding the line data)
Computers and Technology
1 answer:
timofeeve [1]3 years ago
5 0

Answer:

Explanation:

The following program is written in Python. It asks the user for the file name (which needs to be in the same directory as the program) and reads the file. It then splits it by lines and saves it into an array. Then it loops through the array, printing each line with its corresponding line number.

file_name = input("File Name: ")

f = open(file_name, 'r')

lines = f.read().split('\n')

for line in lines:

   print(str(lines.index(line) + 1) + ': ' + line)

You might be interested in
PLEASE HELP!!!
mezya [45]

Answer:

I'm not exactly sure on what the question is, but from reading it, I determined that you'll be creating 2 different designs using Inkscape/Photoshop. I'm leaving 2 of my designs in here for you to use on your project. Unknown on what to do about the design that wasn't created in an image-editing program.

4 0
3 years ago
______design A plan for the actual implementation of the system.
Stella [2.4K]

Answer:

please

Explanation:

6 0
3 years ago
Read 2 more answers
Which transfer of learning occurs when the performance of a maneuver interferes with the learning of another maneuver?
Nutka1998 [239]

Answer:

Negative transfer of learning

Explanation:

Negative transfer of learning occur when the knowledge you've acquired in the past is/are interfering with the one(s) you are currently acquiring.

Example: learning a new language that have some differences in pronunciation from the previous one, changing from a right-sided vehicles to a left-sided vehicles etc.

3 0
3 years ago
What is cloud storage?
Lana71 [14]

in cloud storage we can save data online

8 0
3 years ago
Read 2 more answers
Katherine would like to insert specific words at the top of every page on a multipage essay.
vekshin1

The correct way to insert specific words at the top of every page of a multi page essay is the third option - Type the words onto the first page after selecting the header region of the document by clicking the top edge of the page; it will automatically be repeated in all subsequent header regions of the document.

The steps in the third choice are correct for inserting a header. You should also keep in mind that you can also set the header so that it does not start until the second page, which may be appropriate for an essay.

6 0
3 years ago
Read 2 more answers
Other questions:
  • What does a transistor do?
    13·2 answers
  • Fill in the blank. Do not abbreviate.
    6·1 answer
  • What are 7 key traits for knowing your audience
    6·2 answers
  • While designing your network's VLAN topology, your team has decided to use a centrally managed DHCP server rather than creating
    8·1 answer
  • How to get the home button on your screen?
    13·1 answer
  • Given the following while() loop, which statement is true assuming A,B,C,D are int variables and A > B? while ( ( A >= B)
    8·1 answer
  • Money money money money
    8·2 answers
  • Some printers spray ink, while others use heat or lasers to create images.
    14·2 answers
  • Computer science practical on VB.NET. program 1. program to find the square of a number. write the code achieve it​
    6·1 answer
  • Lynn has created a quarterly sales report using a word processor. The document is confidential, and Lynn wants to secure it with
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!