Question: Fix this code def solution(A): #initialize the bucket myBuckets =[] #store number of fruits count =0; #loop for fruits in A for i in A

Fix this code

def solution(A): #initialize the bucket myBuckets =[] #store number of fruits count =0; #loop for fruits in A for i in A : #if fruit not in the buckets if not myBuckets.__contains__(i): #if bucket length less than two if len(myBuckets)

print(" ") A = [1,2,1,2,1,2,1] print(A) maxFruits=solution(A) print("She can collect max:",maxFruits,"fruits")

Problem:

Fix this code def solution(A): #initialize the bucket myBuckets =[] #store number

Test Output Example test: [1, 2, 1, 2, 1, 2, 11 Output: She can collect max: 1 fruits She can collect max: 1 fruits WRONG ANSWER (got 1 expected 7) Producing output might cause your solution to fail performance tests. You should remove code that produces output before you submit your solution. Test Output Example test: [1, 2, 1, 2, 1, 2, 11 Output: She can collect max: 1 fruits She can collect max: 1 fruits WRONG ANSWER (got 1 expected 7) Producing output might cause your solution to fail performance tests. You should remove code that produces output before you submit your solution

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!