Multiple Lists 4/5 iterations work as expected


#1



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


The first four iterations work but as soon as the program sees that element a is less than element b it prints the lesser element (a)

1
9
17
15
19
None

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


#2

This line of code is creating bug..

if a < b in (list_a, list_b)

Can you find?


#3

Where is the Bug? I can't find it...


#4

I think I see it! I'll adjust it tonight. Thank you for your help!


#5

Hey, thanks for the help. I figured it out! Writing "in (list_a, list_b)" in my if statement is redundant information.


#6

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