sa 12 cs chapter 9

5. Suppose we have a list V where each element represents the visit dates for a particular patient in the las* month. We want to calculate the highest number of visits made by any patient. Write a function MVisit(Lst) to do this.

A sample list (V) is shown below : V = [[2, 6], [3, 10], [15], [23], [1, 8, 15, 22, 29], [14]] For the above given list V, the function MVisit( ) should return the result as [1, 8, 15, 22, 29]. # Code V = [[2, 6], [3, 10], [15], [23], [1, 8, 15, […]

5. Suppose we have a list V where each element represents the visit dates for a particular patient in the las* month. We want to calculate the highest number of visits made by any patient. Write a function MVisit(Lst) to do this. Read More »

1. Write a program that uses a function called find_in_list() to check for the position o f the first occurrence of v in the list passed as parameter (1st) or -1 if not found. The header for the function is given below

def find_in_list (1st, v ): “”” lst – a list v – a value that may or may not be in the list “”” # Code def find_in_list(lst, v): for i in range(len(lst)): if lst[i] == v: return i return -1 # if the value v is not found -1 is returned l = [1,

1. Write a program that uses a function called find_in_list() to check for the position o f the first occurrence of v in the list passed as parameter (1st) or -1 if not found. The header for the function is given below Read More »