Question: Write these functions on python, Help!! def factorial_evens(num): Implement a function to calculate and return the product of all even numbers from 1 up to
Write these functions on python, Help!!

def factorial_evens(num): Implement a function to calculate and return the product of all even numbers from 1 up to num(inclusive if num is even). Assumption: num will always be an integer greater than 1. Examples: factorial_evens (4) rightarrow 8 # 2*4 = 8 factorial_evens (7) rightarrow 48 # 2*4*6 = 48 factorial_evens (2) rightarrow 2 def add_subtract_list(xs): Accumulate the list of numbers from xs by interleaving between addition and subtraction and always start with an addition. Return the final total as a number. Assumption: xs is a list of numbers; xs could be empty. Restriction: You can NOT call sum(). Do NOT modify the incoming list xs. Examples: add_subtract_list([1, 2, 3, 4, 5]) rightarrow 3 # +1-2+3-4+5=3 add_subtract_list([-1, 2, -3, 4, -5]) rightarrow -15 # +(-1)-2+(-3)-4+(-5) =-15 add_subtract_list([]) rightarrow theta def find_multiples(n, xs): Given an integer n and a list of integers xs, check and return the values from xs that are multiples of n as a list, preserving the occurrence order from xs. Assumption: n is a positive integer; xs is a list of integers; xs could be empty. Restriction Do NOT modify the incoming list xs: build up a new list to return. Examples: find_multiples (2, [1, 2, 3, 4, 5, 6]) rightarrow [2, 4, 6] find multiples (5, [5, 10, 5, 10]) rightarrow [5, 10, 5, 10] #keep duplicates find multiples (3, [11, 13]) rightarrow [] def last_index(xs, key): Search through the list xs for value key; return the non-negative index corresponding to the last occurrence of key. it's not found, return None. Remember: the rightmost match should be reported when multiple matches are present. Assumption: xs is a list; xs could be empty. Restriction: You can NOT call .index() or .reverse() -just loop through manually and seek the key. Do NOT modify the incoming list xs. Examples: last_index([5, 10, 15, 20, 25], 15) rightarrow 2 last_index([3, 4, 5, 6, 4, 4, 5], 4) rightarrow 5 # 4 is at indexes 1, 4, 5 last_index [100, 105, 110], 234) rightarrow None
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
