Question: def labw 1 0 Exam 2 ( arr , num, option ) : # Check if the number of arguments is correct if len (

def labw10Exam2(arr, num, option):
# Check if the number of arguments is correct
if len(arr)==0 or len(arr)<2 or option not in [1,2,3]:
return [],[]
counts =0
indices =[]
if option ==1:
for i in range(len(arr)):
if arr[i]< num:
counts +=1
indices.append(i)
elif option ==2:
for i in range(len(arr)):
if arr[i]== num:
counts +=1
indices.append(i)
elif option ==3:
for i in range(len(arr)):
if arr[i]> num:
counts +=1
indices.append(i)
return counts, indices

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!