Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
What does each line show? Say it before you run it.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. any asks "is there at least one?", and all asks "are they all?".
any(m > 80 ...): 85 is above 80. True.all(m > 60 ...): 72, 85 and 64 are all above 60. True.all(m > 70 ...): 64 is not above 70. False.any(m > 100 ...): no mark is above 100. False.any([]) is False, because there is no item that passes. all([]) is True, because there is no item that fails.Check. any stops at the first True, and all stops at the first False.
Answer: True, True, False, False, then False True.
Log in to join the discussion.
Loading…