Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) 2) Hi there need help with these two questions. They are based on python (3.7

ID: 3748951 • Letter: 1

Question

1)

2)

Hi there need help with these two questions. They are based on python (3.7). Your help will be very much appreciated. Much thanks.

Complete the get_evens_list function which is passed a list of integer numbers as a parameter. The function returns a new list which contains all the even numbers and are multiples of three (i.e., exactly divisible by 3). If the parameter list is empty the function should return an empty list. For example: Test Result list1 - [23, 3, 6, 5, 12, 9, 7, 4][6, 12] print (get_evens_list(list1)) print(list1) [23, 3, 6, 5, 12, 9, 7, 4] Answer: (penalty regime: 0 %) 1 def get_evens_list (numbers):

Explanation / Answer

"""
A even number divisible by 2 and multiple of 3 means that the number
should be exactly divisible by 6
"""
def get_even_list(integer):
evens = []
for idx,num in enumerate(integer):
if num % 6 == 0:
evens.append(num)
return evens

"""
Find the length of the string, say n is length of a string a
then for a even length string the middle character is a[n/2]
and for odd length string the middle character is a[n/2+1]
"""
def get_middle(list1):
list = []
for idx,str in enumerate(list1):
length = len(str)
if length % 2 == 0:
list.append(str[length/2] )
else:
list.append(str[length/2 + 1])
  
return lower ( "".join(list) )