Generate a code snippet in Python that validates whether a number is within a given range or not.
def number_in_range(num, start, end):
  if num >= start and num <= end:
    return True
  else:
    return False