Loops prob16 multiple lists


Continuing the discussion from Multiple lists:

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

i don't know what to do with this , can't relate to anything in the problem.

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 :
        print "a is greater."
        print "b is greater."


I don't really understand your error message, but what's wrong is your print statements. You should just print a if it's greater than b, else print b, the variables are what need to be printed :slight_smile:


thanks! such a silly problem :smiley: its done .


It is interesting that in this exercise if statement is not necessary to pass, you can just use maximum of the two lists: max(a, b). :wink:


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