Max function on two zipped lists


#1

Hello, i am on 16 - Multiple lists in Python Loops.

I am supposed to pair up two lists and print the higher number in the new pairs.


Traceback (most recent call last):
File "python", line 6, in
TypeError: 'int' object is not callable


I expect it to print the higher number from the max function.


list_a = [3, 9, 17, 15, 19]
list_b = [2, 4, 8, 10, 30, 40, 50, 60, 70, 80, 90]

for a, b in zip(list_a, list_b):
    # Add your code here!
    print max(a + b)
 # (a,b) doesnt work either


#2

Refresh the page, and try this again ...

print max(a, b)

#3

look at the python documentation - max, you will need to the following:

max(argument1, argument2)

@appylpye, why refresh the page the + needs to be replaced with a , to separate arguments rather then adding them together


#4

The user's comment indicates that (a,b) doesn't work either, possibly meaning print(a,b). That combined with the error message suggests that the user overwrote the max function with an int in a previous submission, for which that overwritten name is still in memory. However, I admit that is just a guess.

Nevertheless, you are right that the user should check the documentation for max.


#5

And here i thought i wrote the post properly.

I thank you both for replies. The refresh page worked properly. Tried it today again with the (a,b) code on a new window of codecademy and the code worked properly. And yes my note in # meant that max (a,b) didnt work either. Thats why i started to experiment and through a series of smart thoughts came to (a+b) where i thought i was working with small lists and not two integers.. I ws desperate by that time..

So i probably called some nonsense to be printed before getting to the print max(a,b) and the page remembered it.


#6