Question: Function Specifications You cannot use list comprehensions to solve any of these problems. If you don't know what these are, don't worry about it, you

 Function Specifications You cannot use list comprehensions to solve any of

Function Specifications You cannot use list comprehensions to solve any of these problems. If you don't know what these are, don't worry about it, you don't need to know about them for this course. 1. Design the function sum_even_values that takes as list of integers as an argument and calculates the sum of only the values in the list that are even. Don't forget to add a test for the empty list! Examples: If the function is called with the list [12, 4, 3, -2] the function should return 14 since 12 + 4 + 2 = 14 2. Design the function count_above that takes as list of numbers and a threshold vaue as arguments and counts the number of values in the list that are above the given threshold. Don't forget to add tests that consider the empty list and around the threshold boundary (below, at, above)! Tip for your type hint... if a function accepts an argument that is a integer or a float, what type hint is used? Examples: If the function is called with the list [12, 4, 2, 22,-4) and a threshold of 2 the function should return 3 If the function is called with the list [1.2, 2.4, 2.7) and a threshold of 2.1 the function should return 2 3. Design the function addi that takes as list of integers as an argument and creates and returns a new list with every value in the given list with 1 added to it. Don't forget to add a test for the empty list! Examples: If the function is called with the list [12, 4, 3,-2) the function should return the list [13, 5, 4, -1] 4. Design the function are_all_even that takes as list of integers and determines whether all of the elements in the list are even. Don't forget to add a test for the empty list - if the list is empty there are not any odd numbers so the function should return True (there are all even). Examples: If the function is called with the list [12, 4, 3, -2] the function should return False If the function is called with the list [12, 4, 30, -2] the function should return True

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!