I have the following lists and would like to get the maximum values for each person and create a new list using exclusively the for loop and max function. How can I do it?
persons = ['John', 'James', 'Robert']
values = [
(101, 97, 79),
(67, 85, 103),
(48, 201, 105),
]
I'm looking for this ouput:
Output 1 = [('John', 101), ('James', 103), ('Robert', 201]
Output 2 = [101, 103, 201]
Can anyone help?
I just do not manage to get this result at all.
output1 = [(i, max(j)) for i,j in zip(persons, values)]
output2 = [max(x) for x in values]