Validated user input (ensure correct/expected data entry)

--Originally published at Py(t)hon

Most of the time we want our program to be able to interact with the user, to ask him questions and him returning input, well, it is very important to validate the input the user is giving so our program doesn’t crash. For example we have a program were the user has to input a number, how we validate that that input will be indeed a number, we can use the try…except….else block, here is how:

valid-1

That’s all #Pug#Valid#Input#ISC#Tec#TC101#NoMore