Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def counter ( start , stop ) : if start > stop: return _ string = Counting down: while _ _ _ # Complete

def counter(start, stop):
if start > stop:
return_string = "Counting down: "
while ___ # Complete the while loop
___ # Add the numbers to the "return_string"
if start > stop:
return_string +=","
___ # Increment the appropriate variable
else:
return_string = "Counting up: "
while ___ # Complete the while loop
___ # Add the numbers to the "return_string"
if start < stop:
return_string +=","
___ # Increment the appropriate variable
return return_string
print(counter(1,10)) # Should be "Counting up: 1,2,3,4,5,6,7,8,9,10"
print(counter(2,1)) # Should be "Counting down: 2,1"
print(counter(5,5)) # Should be "Counting up: 5"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions