So I'm trying to create a function that determines the maximum of a set of values, from scratch.
I'm not sure how to make the function change the new value of Max after a new Max has been found, I'm also not sure if my usage of args is correct.
def Maximum(*args):
Max = 0
for item in List:
if item > Max:
item = Max
return Max
List = [1,5,8,77,24,95]
maxList = Maximum(List)
print str(maxList)
Any help would be hugely appreciated.
for item in Listshould befor item in args.argsis a list of negative numbers, it will return0. You could fix it by error handling for whenargsis empty, and then settingMax = args[0]