16. Multiple Lists


#1



https://www.codecademy.com/en/courses/python-beginner-en-cxMGf/2/3?curriculum_id=4f89dab3d788890003000096#


Oops, try again. "19" was printed instead of "30".


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!
  for a, b in zip(list_a, list_b):
    if a < b in zip(list_a, list_b):
        print b
    else:
        print a


#2

you only need one loop? then a will contain the values from list_a and b will contain the values of list_b, then you can just check if a is greater then a, if so, print a, else print b


#3

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!
if a < b in zip(list_a, list_b):
print b
else:
print a

O/p -

3
9
17
15
19
None

Error message:
Oops, try again. "19" was printed instead of "30".

I am not sure how 19 is getting printed instead of 30. Can you please explain.


#4

well, first you need a loop which uses zip to get values from both list. Then you need an if/else to determine which number is bigger, and print the right number


#5

still didn't work ,

Oops, try again.
"2" was printed instead of "3".

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

#6

a and b now contain values from the list, you can compare those.

no need for in list_a, list_b in your if condition


#10