Menu

(Solved) : 1a 5 Points Write Function Largest34 Returns Sum 3rd 4th Largest Values List Simplicity M Q36545392 . . .

using python

1a) (5 points) Write a function, largest_34(a), that returns the sum of the 3rd and 4th largest values in the list a. For sim1c) (5 points) Write a function, third_at_least(a), that returns a value in a that occurs at least len (a)//3 + 1 times. If n

1a) (5 points) Write a function, largest_34(a), that returns the sum of the 3rd and 4th largest values in the list a. For simplicity, you may assume that the numbers in the list a are all distinct and that the list a has at least 4 elements. For example: >>> largest_34([1000, 1, 100, 2, 99, 200, -100]) 199 1b) (5 points) Write a function, largest_third(a), that cop he oi tho Ien (a)//3 o the lkarg a in the list a. For simplicity, you may assume that the numbers in the list a are all distinct and that the list a has at least 3 elements 1c) (5 points) Write a function, third_at_least(a), that returns a value in a that occurs at least len (a)//3 + 1 times. If no such element exists in a, then this function returns None. 1d) (5 points) Write a function, sum_tri(a,x), that takes a list, a, as input and returns True if there exists indices i, j and k (where i and j and k are not necessarily distinct) such that alij+al+a[k]Ex. Otherwise it returns False. For example, if a [1, 5, 8, 2, 6, 55, 90] and x-103, then sum_tri(a, x) would return True since a +a[2]+a[6]=5+8490-103. If a 1, 1, 5, 8, 2, 6] and x–3, sum_tri(a, x) would return True since aolta[01+a[0]=-1 +-1 +-1–3. If a:[-10,2] and x=-18, sum_tri(a, x) would return True since a[01+a[0]+a 1–10+-10+2-18. lf a-1, 1, 5, 8, 2, 6] and x-1000 would return False, since there are not indices i, j and k such that all+a0l+a[k]-1000. oud retur True since and Show transcribed image text

Expert Answer


Answer to 1a 5 Points Write Function Largest34 Returns Sum 3rd 4th Largest Values List Simplicity M Q36545392 . . .

OR