Question on: SS2 ICT - Basic Programing II
If you wanted to modify the code to handle invalid input, what changes would you make?
To handle invalid input, you would need to implement input validation. This would involve checking if the user's input is a valid number (numeric) and potentially adding error handling. For instance, you could use a try-except block to catch ValueError exceptions if the user enters non-numeric input and provide an error message or prompt the user to re-enter a valid value.
Add your answer
Please share this, thanks!
No responses