Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Read two numbers and show which one is bigger. If they are equal, say so.
Three cases need if, elif and else.
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, compare your working with the solution.
Plan. There are three cases, so we use if, elif and else.
if a > b: shows that a is bigger.elif b > a: shows that b is bigger.else: the numbers must be equal.Check. For and , neither a > b nor b > a is true, so it shows The numbers are equal.
Log in to join the discussion.
Loading…