Question: 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
Get step-by-step solutions from verified subject matter experts
