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
Does anybody know how to do 6.3 code practice on edhesive. NEED ASAP!!!​
Lady_Fox [76]

Answer:

Hopes this helps if not comment and I'll change it

Explanation:

import simplegui

import random

def draw_handler(canvas):

for i in range (0, 1000):

x = random.randint(1, 600)

y = random.randint(1, 600)

r = random.randint(0, 255)

g = random.randint(0, 255)

b = random.randint(0, 255)

color = "RGB( " + str(r) + "," + str(g) + "," + str(b) + ")"

canvas.draw_point((x, y), color)

frame = simplegui.create_frame('Points', 600, 600)

frame.set_canvas_background("Black")

frame.set_draw_handler(draw_handler)

frame.start()

8 0
3 years ago
Could someone please paraphrase this for me and rewrite it in your own words??
Nady [450]

I will master the essentials for the Microsoft application Excel. My newly formed skills will be shown through my work shown through Spreadsheets i create and how i utilize mathematical functions in Excel. I am determined to increase my skill level by 90%. I will achieve this goal by the second marking period.

5 0
3 years ago
Who is the first computer programmer​
enot [183]

Answer:

Ada Lovelace was the first computer programmer

8 0
2 years ago
Read 2 more answers
Write the function "zipper". the function will take two array/list/table parameters and return a new array/list/table which will
MakcuM [25]
What is the problem what am I supposed to do?
4 0
4 years ago
Question 4
Tcecarenko [31]

Answer: squared ← number * number

Explanation:

4 0
3 years ago
Other questions:
  • PLS HELP!!
    13·1 answer
  • Ben chang noticed that his store was lagging in sales . He realized that his staff was not experienced enough . As the store man
    13·2 answers
  • The wired or wireless means of connecting a computer to the internet is called a ________.
    9·1 answer
  • Briefly explain the technology used for fifth generation computers​
    5·1 answer
  • How many data bits are sent in a single psk31 character?
    15·1 answer
  • the default name for the small icon that represents a web site or page, and is displayed in the browsers, typically at the begin
    9·1 answer
  • You and your project team have been asked to generate a solution to a problem. The problem is not complicated, and you are sure
    6·1 answer
  • A certain program takes 26.67 seconds to run on 3 processors and 16 s to run on 7 processors. Find the execution time on one pro
    10·1 answer
  • True / False You should always consider your business requirements before deciding which designs are best for your environment.
    13·1 answer
  • Create a class template for a class named GeneralStackthat holds
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!