I have a function which calculate the max in a list:
def max_in_list(list):
max = 0
for i in range(len(list)-1):
if list[i] > list [i+1] and list [i] > max:
max = list[i]
elif list[i +1] > max:
max = list [i+1]
print max
another one to map the lenght of strings to a new list
def maps(list):
list_integer = []
for i in list:
list_integer.append(len(i))
print list_integer
and I want to calculate the longest word with this one:
def the_longest_word(list):
new_list = maps(list)
max_in_list(new_list)
It looks like the first function return None. My question is how can I assign the returned value to a variable so I can use it in the second function?
max_in_listdoesn't return anything (Noneby default), it just modifies the local variablemax.returnsomething from the function in the first place...