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
Savatey [412]
3 years ago
7

Write a Python function called readlinesmton that accepts the name of the file (i.e. filename), starting line number (i.e. m) an

d ending line number (i.e. n) as a parameter. The function then returns the contents from line number m to n (m < n). If m < 1 then start from line 1. Similarly, if n > number of lines the file, then stop at the last line in the file.
Computers and Technology
1 answer:
KatRina [158]3 years ago
5 0

Answer:

Following are the code to the given question:

def readlinesmton(filename, m ,n):#defining a method that holds three parameters

   f=open(filename, 'r')#defining f variable that holds open method

   l=f.readlines()#defining a variable l that readers input file

   e=len(l)#defining e variable lengths of the file  

   s=m#defining s variable that holds parameter value

   if(m<1):#Using if block that checks m is less than 1

       s=1#use s variable that holds a value that is 1

   if(n < e):#defining n variable that checks n less than e

       e=n #using e that holds n value

   for i in range(s-1, e, 1):#defining for loop that calculates lines  

       print(l[i])#prints lines

readlinesmton("input.txt", -1, 70)#Calling a method

Output:

Please find the ouput in the attached file.

Explanation:

In this code, a method "readlinesmton" is declared that takes three-parameter and inside the method, it uses the open method to open the file, read method to read the file, and len to calculate the length of the file and use the conditional statement to check the file inputs and use the loop to prints its values.    

You might be interested in
4. Which of the following root keys contains the data for a system’s non-user-specific configurations? a. HKEY_LOCAL_MACHINE b.
seropon [69]

Answer:

The system’s non-user-specific configurations are stored in the HKEY_LO-

CAL_MACHINE root key of the Registry.

Explanation:

6 0
3 years ago
How does a Cloud-first strategy differ from other approaches to Cloud?
Brut [27]

Answer:

There is a considerable difference between a cloud-first strategy and other cloud approaches. The developers of the cloud-first strategy are familiar of every data point that requires backup and synchronization. As a result, a lower assembly layout that is more tolerant of database sync is required. In other words, a cloud-first strategy can easily accommodate new technology.

Cloud-first strategy is the current data management method that was not available a few years ago. Such processes and reliability are inapplicable when transferring application software and data to the cloud. You will have to make sacrifices in terms of load balancing and distributed functionality, which will be limited when using other cloud approaches. And this is where Cloud-first strategy shines, as you will be able to control and use all of the host's functionalities.

Explanation:

A cloud-first strategy is one in which all or most of an organization's structure is moved to a cloud-computing environment. Traditionally, organizations required physical supplies to keep their online data; nowadays, they store it on the cloud, which is fundamentally more useful. Cloud-first organizations, regardless of size or importance, are designed to operate their operations on cloud servers. Rather of transferring the organization's data and services to the cloud, adopt a cloud-first strategy and design the application software from the ground up. Not only does the cloud-first strategy outperform traditional application architectures in terms of performance, but it also provides higher stability.

5 0
1 year ago
How do I answer a question that was answered incorrectly on Brainly
Mashcka [7]

Answer:

Explanation:

Go and ask a teacher or search

6 0
3 years ago
Read 2 more answers
If a 60 lb. load is placed on the platform, what will the pressure gauge reading be if the piston area is 5 sq.in? Give your ans
Doss [256]

Answer:

The pressure gauge reading will be;

12 psi

Explanation:

The question relates to relationship of pressure and area

The given parameters for the measurement are;

The weight of the load = 60 lb

The required area of the piston = 5 in.²

Pressure exerted by a force can be defined as follows;

Pressure =  \dfrac{Force}{Area}

The weight of the load = The force applied by the load

Therefore;

Pressure =  \dfrac{Force}{Area} = \dfrac{60 \ lb}{5 \ in.^2}  = 12\dfrac{lb}{in.^2} = 12 \ psi

The gauge reading will be 12 psi.

7 0
3 years ago
Read 2 more answers
This Command to insert copied text anywhere in your document
harina [27]

Answer:

Paste

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • This is a free point thing!! I am giving 100 points!! Anyone wanna talk!!!!
    11·2 answers
  • You are working on an excel table and realize that you need to add a row to the middle of your table. what is one way to do this
    12·1 answer
  • Which of the following is NOT a component of a DFD?
    8·1 answer
  • What function would you use to find the mean in a Microsoft excel document ?
    6·2 answers
  • Which of these is a Microsoft certification for system engineers?
    9·1 answer
  • How does the Rights Management Services feature help to protect information
    11·1 answer
  • (20points)
    6·1 answer
  • Select the three concepts of capital outlay.
    15·1 answer
  • How does 5G technology enhance the Internet of Things (IoT)?
    9·1 answer
  • Write a function called st_dev. st_dev should have one
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!