Sometimes upon receiving numeric parameters it is required to check whether the received numeric value is or not is a positive integer value.
How can we do this in python?
Sometimes upon receiving numeric parameters it is required to check whether the received numeric value is or not is a positive integer value.
How can we do this in python?
One simple way:
if isinstance(number, int) and number > 0:
# number is a positive integer