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
Consider a multiprocessor CPU scheduling policy. There are 2 options: 1) a singlecommon ready queue of jobs; when a CPU becomes
UNO [17]

Explanation:

A ready queue is more adequate since in this method the load balancing occurs in a proper way. The goal of multiple processing is the correct distribution of load.

But in the cases when a processor is doing quicker or taking a smaller queue, it will self assign processes allotted for execution, configuring it with a constant busy state.

3 0
3 years ago
The physical layer of the OSI model is not foundational to any of the other layers. True or False
galina1969 [7]

Answer:

False.

Explanation:

OSI model stands for Open Systems Interconnection. The seven layers of OSI model architecture starts from the Hardware Layers (Layers in Hardware Systems) to Software Layers (Layers in Software Systems) and includes the following;

1. Physical Layer

2. Data link Layer

3. Network Layer

4. Transport Layer

5. Session Layer

6. Presentation Layer

7. Application Layer

Each layer has its unique functionality which is responsible for the proper functioning of the communication services.

The physical layer of the OSI model is the first layer of the OSI model and it is foundational to any of the other layers because it determines the means of transmitting (sending) raw bits from one network node to another and the electrical specification of network equipments.

5 0
3 years ago
I am currently building my own PC is there any part I should put first? Or is it just whatever?
Dominik [7]

Basically, I had the same question when I got my PC! You can do any part you choose as long as you put it together in the right place.

Hope this helped you!

4 0
3 years ago
Read 2 more answers
_______ technology is used in many hospitals to verify that the correct medication is being dispensed to the applicable patient.
Zepler [3.9K]
Barcode hospital operating suites, cardiac and intensive care units.
8 0
3 years ago
Where can you find the Language and Advanced features in Outlook?
igor_vitrenko [27]

Answer:

File tab, Options link.

Explanation:

Microsoft Outlook is an e-mail and a personal information manager (PIM) application software that was designed and developed by Microsoft Inc., to avail end users the ability to send and receive electronic messages on their computers.

An e-mail is an acronym for electronic mail and it is a software application or program designed to let users send texts and multimedia messages over the internet.

You can find the Language and Advanced features in Outlook by navigating to the File tab and selecting or clicking on the Options link.

4 0
3 years ago
Other questions:
  • PL Technologies suffered considerable data loss when its database was infected by a virus. George, an operations personnel, atte
    8·1 answer
  • Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
    13·1 answer
  • What are some areas to fill out in the New Formatting Rule dialog box? Check all that apply.
    13·2 answers
  • Describe how an attacker can use whois databases and the nslookup tool to perform reconnaissance on an institution before launch
    8·1 answer
  • In a non-formatted/standard template, if the number 25 is converted to text format, the
    14·1 answer
  • How does color affect your mood?
    11·2 answers
  • What determines how a system will work to meet the business needs defined during system investigation?
    13·1 answer
  • Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe
    13·1 answer
  • The meaning of docile can be determined by the... context clue. synonym atonym or explanation
    14·2 answers
  • PLSS HELP ASAP ILL GIVE BRAINLIES THANKS
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!