# 16/19 Multiple Lists: The smaller list is printed and not the larger

#1

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):
[TAB] If b > a:
[TABTAB] print b
[TAB] elif a > b:
[TAB,TAB] print a

The instructions say to use zip to compare each pair of elements and print the larger of the two. The code works, and allows to proceed to the next lesson, but it prints list_a, which is the smaller of the two.

I could have misunderstood what was happening when comparing the two lists, but my understanding is that list_b is larger so it should be printed. Any input or clarification on this would be much appreciated. Also, I apologize for the [TAB] formatting.

#2

Resolved
Immediately afterwards figured out that it compares the two elements of each respective list, and prints the larger of the two elements. Apologies.

#3

Not sure if this was a work around or the actual code that Codecademy was looking for. But it did get the right output. Curious to know if there was a more efficient way to get the answer.

for a, b in zip(list_a, list_b):
if a > b:
print a
else:
print b

#4

for a, b in zip(list_a, list_b):
"tab" if a > b:
"tab""tab" print a
"tab" else:
"tab""tab" print b

Really wish the indentation would transfer over to the actual comment. I just realized why people type those tabs in there to show the indentation.

#5

```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): print max(a, b)`

#6

this is the most concise way to get the result desired for this exercise's goal.

thank you!

#7

what is the purpose of the max function

#9

Description
The method max returns the elements from the list with maximum value.

Syntax
Following is the syntax for max() method

http://www.tutorialspoint.com/python/list_max.htm