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
What are some examples of duties Information Support and Service workers perform?
Tanzania [10]

Answer:

3

Explanation:

8 0
3 years ago
Read 2 more answers
Friction is the
grin007 [14]
D. resistance of movement between two surfaces in contact.
The more friction an object has, the slower it will move. Heavier objects have more friction. For example, a heavier car will have more friction than a car with less weight, therefore the lighter car will travel faster.
5 0
3 years ago
Company ABC has always used passwords to protect the highly confidential information in their company. Recently, someone who was
Leno4ka [110]
Company ABC should use passwords but also have them use a code so that not just anyone can get in. Kinda like facebook.
3 0
3 years ago
Non-Discretionary Items will increase or decrease without any action by Congress or the President. Which of the following is NOT
Alex_Xolod [135]
<span>A. Military Spending</span>
7 0
4 years ago
Which of the following is not a popular bitmap editing application?
zloy xaker [14]
I think the answer is c GIMP
4 0
3 years ago
Read 2 more answers
Other questions:
  • The proper hand position for keyboarding.
    7·1 answer
  • How do you understand a scientific problem? Give two (2) examples of a scientific problem you
    10·1 answer
  • Your task is to improve a multi-threaded program that frequently writes small entries to a shared file by introducing a layer th
    7·1 answer
  • Does the game best fiend need wifi to play on the app?
    8·2 answers
  • Pop3 allows users to fetch and download e-mails from a remote mailbox. does this mean that the internal format of the mailboxes
    14·1 answer
  • Seven Features of computer aids design software
    6·1 answer
  • A Turing machine with doubly infinite tape (TMDIT) is similar to an ordinary Turing machine except that its tape is infinite to
    8·1 answer
  • What is a non-example of job skill
    13·1 answer
  • Why do we use if statements?
    9·1 answer
  • What is the duty of WHH? (white hat hackers)<br><br><br>ANY WHH HERE?<br>​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!