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

Implement function evenrow() that takes a 2D list of integers and returns True i

ID: 3546936 • Letter: I

Question

                            Implement function evenrow() that takes a 2D list of integers and returns True if each row of the table sums up to an even number and False otherwise                             (ie if some row sums up to an odd number)                         

                        

                            >>>evenrow([[1,3],[2,4],[0,6]])                         

                        

                            True                         

                        

                            >>>evenrow([[1,3,2],[3,4,7],[0,5,2]])                         

                                                     False

Explanation / Answer

def evenrow(lst): for i in range(len(lst)-1): if sum(lst[i]) % 2 != 0: # here is the problem, it only iterates over the first item in the lst [1, 3] - i cant figure this out - range problem? return False return True

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