Question: def maxinlist(list): max= list[0] for a in list: if a < max: pass elif a>max: max=a return a print(maxinlist([1,5,1,-5,3])) def max_num_in_list( list ): max =
def maxinlist(list): max= list[0] for a in list: if a< max: pass elif a>max: max=a return a print(maxinlist([1,5,1,-5,3]))
def max_num_in_list( list ): max = list[ 0 ] for a in list: if a > max: max = a return max print(max_num_in_list([1,5,1,-5,3]))
Why does one work properly but the other doesn't
Please explain clearly. I did the one that doesn't work properly
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
