Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

def catch_bus(dist, time, k): # create more variables as needed! ans = -1 return

ID: 3744363 • Letter: D

Question

def catch_bus(dist, time, k):

# create more variables as needed!
ans = -1
  
return ans

catch_bus(dist, time, k): Given the distance to a bus stop (in feet), and the time to the next bus arrival (in seconds), figure out what is the slowest speed we can travel (feet per second) and arrive in time to catch the bus. The catch is that we can only travel in multiples of k feet per second. o o o o o Assume dist and time are non-negative integers. Assume k is a positive integer There is no upper limit to how fast we can run, awesome! Remember, you can use branching and loops if you want. As will normally be the case in our class, you may not import any modules to complete your work (we will deduct up to all credit earned using the imported functionality). The goal is not to "phone it in", but to learn how to do the computations by yourself, catch bus (100,30,1) catch_bus (100,20,1) catch bus(1ee,20,2) 4 5 6

Explanation / Answer

def catch_bus(dist, time, k): speed = k while True: if time * speed >= dist: return speed speed += k print(catch_bus(100, 30, 1)) print(catch_bus(100, 20, 1)) print(catch_bus(100, 20, 2))