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

PLEASE HELP ME TO FIX THIS CODE!!! I HAVE BEEN SEATING DOWN FOR HOURS TRYING TO

ID: 3702620 • Letter: P

Question

PLEASE HELP ME TO FIX THIS CODE!!! I HAVE BEEN SEATING DOWN FOR HOURS TRYING TO FIX THIS

Run Window Help a7-functions 231?q1 a7-functions Xeq1 Dq2 ?q3 return list 24 25e def largest even (num list): 27 28 29 30 31 32 Takes List of integers and returns Largest even integer in the List If no even number, returns false Use: result=Largest-even(num List) p. Preconditions num list List of numbers user has entered (int) 34 35 36 37 38 39 Postconditions returns: result Fatse, if the List has no even integers or The targest even integer in the list size-len(num list) 41 even list [ 42- for index in range(size 43 if num list/index! % 2-0: even list.append (num list[index]) 45 size-even if size even len(even-list) --'e; 46 = 47 result - False 49 50 51 52 53 54 else: result max(even_list) return result 555 def find value(num 1ist, target): 56 57 58 59 60 61 locations [] size len(num list) for index in range(size): if target num list[index]: locations.append(index) 62 63 return locations 64 D Console 23 nguy7670 workspacelnguy7670 a7srelq2.?? «terminated> C:Users Enter item: 5? Enter item: 1', 30', '40', '50 Traceback (most recent call last): File "C:Users guy767@workspaceInguy7670 ansrca2.??", line 19, in

Explanation / Answer

The problem is solved

def largest_even(num_list):
   #first convert each element in num_list to integer to perrform operation using list comprehension to avoid error "not all arguments are converted during string formatting"
   num_list=[int(i) for i in num_list]
   size=len(num_list)
   even_list=[]
   for index in range(size):
       if num_list[index]%2==0:
           even_list.append(num_list[index])
   size_even=len(even_list)
   if size_even==0:
       result=False
   else:
       result=max(even_list)
   return result

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote