Assuming played_chicket and winning_chicket are 2 random lists wiht 4 elements each, what does this loop returns? I can't understand the logic behind it. Won't it return True always because the ''return True'' statement is outside the loop? I know it will return false if any of the elements are different but i can't see why. Can someone please, explain it to me?
def check_ticket(played_ticket, winning_ticket):
# Check all elements in the played ticket. If any are not in the
# winning ticket, return False.
for element in played_ticket:
if element not in winning_ticket:
return False
# We must have a winning ticket!
return True