I had some trouble figuring out how use a condition with the input type but i solved it with some reading. Here is the code that prove it:

The program will only start to work if it is a positive integer number, otherwise (if it is a string or a negative number) it will ask the user for the number repetitive times until the program receives a positive integer number

CC BY 4.0 Mastery 29 – Validated input by Jose Carlos Peñuelas Armenta is licensed under a Creative Commons Attribution 4.0 International License.