Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started