Home / Expert Answers / Computer Science / restrictions-any-function-that-violates-the-following-will-receive-significantly-fewer-points-ev-pa782

(Solved): Restrictions Any function that violates the following will receive significantly fewer points ev ...



Restrictions
Any function that violates the following will receive significantly fewer points even if it passes all tests.
-

(2) find_mode () \#you have to determine the signature (8 pts) Description: Design and write a function called find_mode() wh

Restrictions Any function that violates the following will receive significantly fewer points even if it passes all tests. - You are not allowed to import anything - You are not allowed to use the global keyword, nor should you have any global variables. (In other words, do not create any variables outside of a function definition. - You are not allowed to use slicing (except for the \( 5^{\text {th }} \) function add_chars) - You are not allowed to use anything that hasn't been covered in class - No built-in function except round(), range(), and len() is allowed - From list methods, you are allowed to use .append(), .insert(), .remove(), or del - From dictionary methods, you are allowed to use .keys(), .values(), .items() - Please do not ask on piazza whether you can use .sort(), sorted(), .index(), .count(), etc. (no) (2) find_mode () \#you have to determine the signature (8 pts) Description: Design and write a function called find_mode() which determines which element(s) from a list occurs the most. The mode is returned as a list, with one or more elements in it. (If there is a tie for the most-occurring, then both/all must be in the list.) If the list is empty, the mode is and empy list. Parameters: (read the description carefully) Return value: (read the description carefully) Assumptions: - The items in the list are the same data type. - The list is non-empty. Examples: find_mode \( ([12,11,12,3,6,7,9]) \rightarrow[12] \) find_mode(["hat", "sweater", "pants", "sock"]) \( \rightarrow \) ["hat", "sweater", "pants", "sock"] 2


We have an Answer from Expert

View Expert Answer

Expert Answer


Steps to write the code: 1. if the list is empty 2. then return an empty list as result 3.
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe