To check the input, use an if/else or a try/except statement. Use a continue statement to move on to the next iteration if the input is invalid. Use a break statement to exit the loop if the input is correct.
The flag variable will initially be set to false and if we can determine that the input data is what we are expecting, the flag status can be set to true and we can determine what can be done next based on that. The validation can be done in two different ways, namely by using a flag variable or by using try or except. For specific data types, validation should strive to be as tolerant of various forms of input as possible.
Learn more about variable here-
https://brainly.com/question/13084948
#SPJ4