Page 1 of 1

PROBLEM 4 (12 pts) - List of frequent elements Write a function which receives as input a lists and a number n (the freq

Posted: Wed Apr 27, 2022 3:37 pm
by answerhappygod
Problem 4 12 Pts List Of Frequent Elements Write A Function Which Receives As Input A Lists And A Number N The Freq 1
Problem 4 12 Pts List Of Frequent Elements Write A Function Which Receives As Input A Lists And A Number N The Freq 1 (41.17 KiB) Viewed 27 times
PROBLEM 4 (12 pts) - List of frequent elements Write a function which receives as input a lists and a number n (the frequency), and returns as result a list of frequent elements (i.e. elements which appear at least n times in this list). def frequentElements (someList, n): Example: frequentElements([6,4,3,5,8,7,3,8,4,4,8],2) frequentElements([6,4,3,5,8,7,3,8,4,4,8],3) --> [3,8,4] --> [4,8] Note: the elements in the returned list should be according to the order they fulfill the frequency criterion (when checked left to right). Each frequent element should appear just once.