+ This code works well, but will end with an exception if the user types anything other than a whole number (such as 12.5 or two). If we wanted to ensure the code will continue to run until the user enters the correct format, we could add <c>try-except</c> (Python) or <c>try-catch</c> (Java) blocks within a <c>while</c> loop that iterates until the user enter the correct code. While try-except blocks aren't strictly required in Python, <xref ref="python-square-input-exception" text="type-global"/> shows how using them alongside a while loop makes the code more robust.
0 commit comments