The bigger number
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
This one builds on a lesson you haven't finished yet. Do that lesson first:
Python Basics · Making decisions →
The bigger number
Read two whole numbers a and b, one per line, with int(input()) (for example 8 and 15). Store the bigger one in biggest and print it. If they are equal, print equal instead.
A branch can set a variable, not only print. Give biggest a value on every path that prints it, or one path leaves it undefined and Python says NameError. Test the tie first: max alone cannot tell you that the two numbers were equal.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Read two whole numbers a and b, one per line, with int(input()). Store the bigger one in biggest and print it. If they are equal, print equal instead.
Click Run to see the output here.