diff --git a/solutions/is_positive.py b/solutions/is_positive.py index 2a8e7bce2..37cb1015c 100644 --- a/solutions/is_positive.py +++ b/solutions/is_positive.py @@ -1,58 +1,38 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- """ -A module for checking if a number is positive. +Created on XX XX XX +A module for checking if an integer is positive. -Author: Luyando Chitindi -Date: 12/22/2024 - - -This module contains a function that deals with checking if a number is positive. -The function will take an integer as an input and returns a boolean value indicating -whether the number is greater than zero. - -Function: -- is positive(number: int) -> bool - - -Exceptions: --Raises TypeError if the input is not an integer. - - -For Example: ->>> is_positive(5) -True ->>> is_positive(-3) -False ->>> is_positive(0) -False +@author: Luyando .E. Chitindi """ def is_positive(number: int) -> bool: """ - This will check if the number is positive. - - - Arguments: - number (int): The number to check if it is positive. - - - Returns: - bool: True if the number is positive, false otherwise. - - - Raises: - TypeError: If the argument that is provided is not an integer. - - - Example: - >>> is_positive(10) - True - >>> is_positive(-5) - False - >>> is_positive(0) - False + This checks if an integer is positive. + + Parameters: + number: int, the number to check + + Returns -> bool: + True if the number is positive, false otherwise. + + Raises: + AssertionError: if the input is not an integer + + Example: + >>> is_positive(4) + True + >>> is_positive(-3) + False + >>> is_positive(0) + False + >>> is_positive("hello") + Traceback (most recent call last): + ... + AssertionError: Input must be an integer. """ - if not isinstance(number, int): - raise TypeError("Input must be an integer.") + assert isinstance(number, int), "Input must be an integer" return number > 0