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
SCORPION-xisa [38]
3 years ago
14

The loop function is similar to range(), but handles the parameters somewhat differently: it takes in 3 parameters: the starting

point, the stopping point, and the increment step. When the starting point is greater than the stopping point, it forces the steps to be negative. When, instead, the starting point is less than the stopping point, it forces the step to be positive. Also, if the step is 0, it changes to 1 or -1. The result is returned as a one-line, space-separated string of numbers.
Computers and Technology
1 answer:
nexus9112 [7]3 years ago
5 0

Answer and Explanation:

def loop(start, stop, step):

   return_string = ""

   if step == 0:

       step = 1

   if start > stop:  # the bug was here, fixed it

       step = abs(step) * -1

   else:

       step = abs(step)

   for count in range(start, stop, step):

       return_string += str(count) + " "

   return return_string.strip()

You might be interested in
Consider the following methods.public void modParams(int[] x, int[] y, String[] s){x[1] = 5;y = x;s[1] = new String("five");s =
skad [1K]
I am not too happy to be a good man in my world but he is made me very very much and he is made me very very much and he is very much very good to him very much and he is very much very good to you very good and very much to be able for my kids with a little more money will not go back and you can do the greatest if he can be very much and you have no problem and then we do all the way that we are not the right answer but you have a question to do and you don’t have the right right answer the answer right back and he will not be very good I am very good and he is very very bad
5 0
3 years ago
Answer to this if you have apex legends on either pc xbox one or PS4 for the one that answers and does gets brainliest please do
weqwewe [10]

Answer:

I got it on Ps4

3 0
3 years ago
Read 2 more answers
When the + operator is used with strings, it is known as the?
Darya [45]
Concatenation, which mean we combine two or more strings into one.
5 0
3 years ago
What can a method do with a checked exception? Check the exception or ignore it. Return the exception to the sender or handle it
Serggg [28]

Answer:

Handle the exception in a catch block or throw the exception to the method that called this method.

Explanation:

The try and catch statements occur in pairs. The try statement allows the user to define a block of code to be tested for errors while it is being executed.

The catch statement allows the user to define a block of code to be executed, if an error occurs in the try block.

If an exception is checked by a method, the method either handles the exception in a catch block or throw the exception to the method calling it.

8 0
3 years ago
Read 2 more answers
Create a script that asks for the student's percentage point through a prompt box. Using the following scenarios write if else s
Valentin [98]

Answer:

<h2>Following are the java script code for the above question. </h2>

Explanation:

Program :

var percentage= prompt("Enter the percentage of the student"); // take the input from the user.

if(percentage>=90)//check condition for greator than 90.

alert("your grade is \"A\"");

else if(percentage>=80) // check condition for 80 and 89.

alert("your grade is \"B\"");

else if(percentage>=70) // check condition for 70 and 79.

alert("your grade is \"C\"");

else if(percentage>=60) // check condition for 60 and 69.

alert("your grade is \"D\"");

else // check condition for less than 60.

alert("your grade is \"F\"");

Output:

  • If the user input 60, it will prints D.
  • If the user inputs 59, it will prints f.

Code Explanation:

  • The above code is in a javascript language, In which the first line is used to display the message and take the input from the user in the alert box.
  • Then the percentage is checked by the help of in if, else if and else statement and print the grade.
  • Then the grade is printed with the help of an alert box.
5 0
3 years ago
Other questions:
  • Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
    12·1 answer
  • In the event you get pulled over for a traffic stop, describe the situation from the police officer's perspective and list at le
    6·2 answers
  • VOTE!
    11·1 answer
  • Help giving points mark BRAINLEST
    5·1 answer
  • What made it possible to develop personal computers?
    10·2 answers
  • Suppose a company A decides to set up a cloud to deliver Software as a Service to its clients through a remote location. Answer
    8·1 answer
  • A(n) ________ is a chart based on PivotTable data.
    15·1 answer
  • . When attempting to minimize memory usage, the most efficient way to do group processing when using the MEANS procedure is to u
    13·1 answer
  • 1. Which of the following cables are used in networking? Check all that apply.
    8·2 answers
  • Robert is risk manager at TPT Bank has been asked to implement an updated badge reader system for addressing access control risk
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!