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

Suppose you have a Scheme function that counts the number of patient visits in a

ID: 3646303 • Letter: S

Question

Suppose you have a Scheme function that counts the number of patient visits in a certain town to a mobile medical clinic. The clinic visits the town occasionally, so for most days the number of patient visits will be 0. You have data for 128 days. For this problem you will write a Scheme procedure that takes in


a function f, that gives the number of patient visits on each day from day 1 to day 128,
an integer a, the start day of your range, and
an integer b, the end day of your range,

and returns the average number of patients visits for the days when the clinic was in town.

Example: suppose the patient visit function is as follows:

(define (visits n)
(cond ((= n 10) 20)
((= n 18) 18)
((= n 39) 52)
((= n 52) 12)
((= n 78) 23)
((= n 88) 34)
((= n 103) 18)
((= n 111) 11)
((= n 126) 33)
(else 0)))

Then your procedure applied to visits, a = 19 and b = 78 should return 29 because there are 3 days with patient visits during the range, and (52 + 12 + 23)/3 = 29.

Explanation / Answer

I would like to explain the algo using python code Let R[]and S[] be arrays where data is stored Now given a and b run a for loop count = 0 sum = 0 for i to n: #where n is the number of clinic visits in a week if a
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote