Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You were given an example of a while loop that increments from 5 to 100: start_num = 5 end_num = 100 count_by = 2 break_num

You were given an example of a while loop that increments from 5 to 100:

start_num = 5 end_num = 100 count_by = 2 break_num = start_num while break_num < end_num: break_num += count_by print(break_num) #should be 101

Here, please convert this code logic into a Python Function, which takes start_num, end_num, count_by as parameters and returns break_num. The signature of the function is:

def my_function(start_num, end_num, count_by): # YOUR CODE HERE # ... return break_num

## After writing the function, test your code to see if you get 101 my_function(5, 100, 2)

## Try another test case to see if you get expected answer, 201 my_function(105, 200, 2)

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions