-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
challenge: factorial_36 #52
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions for Improvement:
- Module Docstring in Test File: Add a descriptive docstring at the top of the test file to explain its purpose.
- Test Method Names: Use more descriptive names for the test methods. For example, rename test_factorial_positive to test_factorial_with_positive_numbers.
- Test Method Logic: Separate logic within test methods into individual methods for clarity and simplicity.
- Function Docstring: Mention the assumption that the input should be a non-negative integer and document any assumptions about the return value.
- Doctests: Include at least 3 passing doctests in the function docstring to demonstrate its behavior.
- Function Call: Ensure the function is only called under if name == "main".
- Linting Checks: Run Ruff linting checks and address any issues to ensure code quality.
This review ensures that the factorial.py solution code and its test file meet all requirements.
Hello @SEMIRATESFAI I have made the requested changes to the code according to your review. Could you please take another look and let me know if everything is now correct? thank you for your time and feedback. |
It looks like your factorial.py code adheres well to the checklist criteria. Great job! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like your factorial.py code adheres well to the checklist criteria. Great job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like your factorial.py code adheres well to the checklist criteria. Great job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job on the changes you have made!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job updating what was required.
name: solution review factorial
about: A template PR for code review with a checklist
Behavior
The factorial function calculates the factorial of a given number using a recursive approach. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. It is often denoted as n!.
Arguments:
n (int): The non-negative integer whose factorial is to be calculated.
Returns:
The function returns an integer representing the factorial of n.
Behavior:
The function takes a non-negative integer n as an argument.
It checks if n is equal to 0. If so, it returns 1, as 0! is defined to be 1.
If n is not equal to 0, the function recursively calls factorial(n - 1) and multiplies the result by n.
This process continues until n reaches 0, where each recursive call returns the product of the integers up to that point.
Example:
print(factorial(5)) # Prints 120, as 5! = 5 * 4 * 3 * 2 * 1
print(factorial(0)) # Prints 1, as 0! = 1
Files
/tests/test_file_name.py
Unit Tests
Function Docstring
Raises:
The Function
Strategy
Do's
Don'ts
Implementation
when it's too restricting.
print
statements anywhere