No, you should not write any validation unless the question explicitly requests it. For example, if a question says to print the first n prime numbers and the predefined code includes something like:
n = 5
Then it is not necessary to validate that n is a number or that n is greater than zero unless the question explicitly indicates that some kind of validation should be applied.