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
sukhopar [10]
3 years ago
13

Define and test a function myRange. This function should behave like Python’s standard range function, with the required and opt

ional arguments. Do not use the range function in your implementation! (Hints: Study Python’s help on range to determine the names, positions, and what to do with your function’s parameters. Use a default value of None for the two optional parameters. If these parameters both equal None, then the function has been called with just the stop value. If just the third parameter equals None, then the function has been called with a start value as well. Thus, the first part of the function’s code establishes what the values of the parameters are or should be. The rest of the code uses those values to build a list by counting up or down.)
Computers and Technology
2 answers:
Reil [10]3 years ago
4 0

Answer:

YOU DONT HAVE A QUESTION ITS A LONG STATEMENT

Explanation:

Sloan [31]3 years ago
4 0

Answer:

#section 1

def ran(first, *last):

   li = []

#section 2

   try:

       if len(last) > 2:

           raise ValueError

       

       elif len(last) == 1:

           while last[0] > first:

               li.append(first)

               first = first + 1

           print(li)

       

       elif len(last) == 2:

           while last[0] > first:

               li.append(first)

               first = first + last[1]

           print(li)

           

           

       else:

           i=0

           

           while i < first:

               li.append(i)

               i= i + 1

           print(li)

                  

   except:

       print("Ran expected at most three arguments at most got", len(last)+1)

   

 

Explanation:

#section 1

The function is defined and a list is created to hold the range of values specified.

It is important to note that the function was created using one required argument and using by *args (*last), The function is allowed to accept extra positional arguments.

#section 2

In this section, we limit the extra positional arguments to two using a try and except block and raising a value error anytime a positional arguments more than three (remember we have 1 required argument) is entered.

The *args supply their arguments in a tuple.

Finally, within the try and except block depending on the arguments given; IF, ELIF and ELSE blocks are available to take those arguments and return the appropriate answer to generate the required range of values

You might be interested in
Which of theses is NOT one of the standard Text filters in Excel 2013?<br><br>​
aalyn [17]

Yes, it is possible to move a worksheet to open another workbook but not to copy it there. Explanation: Microsoft Excel is a powerful tool for organizing work or business-related things etc.

6 0
2 years ago
g What differences do you anticipate there being between working inside vs outside City government in data and digital services?
Ivanshal [37]

Answer:

The work with city government is better than outside city government due to the reasons given below.

Explanation:

There are many differences while working in city government or outside city government. I choose city government job in data and digital service due to the following reasons.

  1. City government provides all types of facilities that are required in data management and digital services.
  2. Provision of more benefits along with salary from city government.
  3. City government arrange different training and development sessions for their employ.
  4. There are many learning and development opportunities, because they provide opportunity to work in different departments.  
  5. City Government have better HR policies as compared to outside government.
6 0
3 years ago
What sentence could Lou’s granddaughter not answer? Explain the context and discuss whether you could answer this question or no
Tanya [424]
He wouldn’t answer the context for the discussion
7 0
2 years ago
"Why learning how to type is so important.
djverab [1.8K]
The productivity of a business depends on how things are done faster. To complete your work faster it is important to develop typing skills. Typing helps you to work comfortably on the computer, it aids in communicating with colleagues and customers, creating documents, and finding new information.
Hopefully this helped.
8 0
3 years ago
When an individual user works in _____, the workstation performs all the functions of a server by storing, accessing, and proces
anyanavicka [17]
When an individual user works in stand-alone mode, the workstation performs all the functions of a server by storing, accessing, and processing data as well as providing a user interface.​
4 0
3 years ago
Other questions:
  • A bookmarking site is a website that enables members to manage and share media such as photos, videos, and music. true or false
    14·1 answer
  • The syntax used for referencing cells with their worksheet names is the sheet name, followed by ____, then the usual column lett
    8·1 answer
  • What is a quick way to close the header or footer view in a microsoft word document?
    12·1 answer
  • A(n ____ is anything about which data are to be collected and stored.
    8·1 answer
  • 2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaExceptio
    6·1 answer
  • What is the purpose of a email
    11·2 answers
  • Which functions are examples of logical test arguments used in formulas? Check all that apply. OR IF SUM COUNT NOT AND
    12·2 answers
  • You are the head of the corporate security department, and the Microsoft teamhas asked you for some assistance in setting the pa
    11·1 answer
  • Match each role to the corresponding web development task.
    14·1 answer
  • How many of the colonists of Jamestown died before they made it to shore, due to the difficult voyage?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!