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
erastovalidia [21]
2 years ago
6

Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the

screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been displayed.
Computers and Technology
1 answer:
tangare [24]2 years ago
5 0

Answer:

Written in Python

filenm = input("File name: ")

myfile = open(filenm+".txt")

for i in range(10):

     line = myfile.readline()

     print(line)

print("End of file")

Explanation:

This line prompts user for file name

filenm = input("File name: ")

This line creates an instance of the file

myfile = open(filenm+".txt")

This line iterates through the 10 lines

for i in range(10):

This line reads the line

     line = myfile.readline()

This line prints each line

     print(line)

This line prints a message indicating that all possible lines have been printed

print("End of file")

You might be interested in
in a particular factory, a team leader is an hourly paid production worker who leads a small team. in addition to hourly pay, te
malfutka [58]

Facilitate team development for successful project completion. Through coaching and mentoring, provide teammates with technical leadership.

Establishing best practices and habits will help the team maintain high standards for the quality of its software. Identify and promote the team's potential development and improvement areas.

#include<iostream>

using namespace std;

/*C++ Function to print leaders in an array */

void printLeaders(int arr[], int size)

{

  for (int i = 0; i < size; i++)

   {

       int j;

       for (j = i+1; j < size; j++)

       {

           if (arr[i] <=arr[j])

               break;

       }  

       if (j == size) // the loop didn't break

           cout << arr[i] << " ";

 }

}

/* Driver program to test above function */

int main()

{

   int arr[] = {16, 17, 4, 3, 5, 2};

   int n = sizeof(arr)/sizeof(arr[0]);

   printLeaders(arr, n);

   return 0;

}

Learn more about Development here-

brainly.com/question/28011228

#SPJ4

7 0
1 year ago
Bertha was recording a drama club practice. during editing, she noticed that she missed recording the beginning of a shot in the
Ray Of Light [21]

Bertha should use end roll technique so that she doesn't miss the initial action of a drama.

b. end roll

<u>Explanation:</u>

End roll is a simple method to decide whether the film is pushing ahead or not. When you utilize the film advance to wind the film, you essentially need to check if the handle on the left (that you use to rewind the film) is turning.

In the event that it turns, great, it implies that the film is appropriately locked in. So Bertha should utilize the end move strategy with the goal that she doesn't miss the underlying activity of a dramatization.

5 0
3 years ago
Which automatic startup option should you choose when windows' startup fails immediately after installing a new driver but befor
Luda [366]

Answer:

last known good configuration

Explanation:

If you're having difficulties starting Windows, the Last Known Good Configuration, or LKGC for short, is a technique to get it started. It loads the drivers and registry data from the last time you began and shut down your computer successfully.

3 0
2 years ago
What is the first thing you should do to find a mean and range of data?
KatRina [158]

Answer

To find mean of data add all the numbers in the set of data and divide the sum by the number of addends.

To find range, identify the difference between the highest value and lowest value in the set of data.

Explanation

Mean, mode, median and range are the primary measurements used to get the measures of central tendencies. To get the mean and range; first arrange the data in an ascending order, then identify the highest value and the lowest value in the set. The difference between these two data values gives the range of the set of values. For the mean, add all the set of values and then divide their sum with the number of values in the set of data.


6 0
3 years ago
What should you keep in mind when installing hard drives?
Diano4ka-milaya [45]
Always touch a metal object before installing to prevent short circuiting the hard drive.
5 0
3 years ago
Other questions:
  • Your mobile device files can be synchronized using ________. hdmi a secure digital transmission a display adapter a cloud servic
    11·1 answer
  • Most keyboards today are in a
    8·1 answer
  • In which scenario would instant messaging be more useful than other forms of communication?
    10·1 answer
  • The process of searching for a special pattern of symbols within a larger collection of information is called pattern ____.
    12·1 answer
  • A lamp outside a front door comes on automatically when it is dark, and when someone stands on the doormat outside the front doo
    7·1 answer
  • Help giving points mark BRAINLEST
    5·1 answer
  • If you decide you want to meet someone you met online, what should you do first? A. Tell your best friend. B. Call the person yo
    12·1 answer
  • Identify an advantage of the software as a service (SaaS) approach in public cloud computing. Group of answer choices The user h
    5·1 answer
  • This assignment will again take the form of a compare/contrast essay. You will use the fresco of Christ Teaching the Apostles in
    14·1 answer
  • Differentiate between patent and copyright.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!