16Multiple lists


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)

Is max a better choice?
but the hint is: Use an if statement to compare the two and print whichever is larger.


If you want to go with the hint, you could do

for a,b in zip(list_a, list_b):

if a >= b:
print a
print b

Excuse the whitespace, I don't think it lets me indent

Otherwise, yes,
print max(a,b)

does work as well and is much conciser...but for learning purposes :wink:


yeah, that's right .thank you Sam . :grin:


I'd say max() is more of a programmer's choice, since it takes the less space :wink: Good thought


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.