• English
  • Español
  • Português do Brasil

No, you should not write any validation unless the question explicitly requests it. For example, if a question asks you to print the first n prime numbers and the predefined code includes something like:

n = 5

Then it is unnecessary to validate whether n is a number or greater than zero unless the question explicitly states that some kind of validation is required.