Skip to content

Commit

Permalink
Merge branch 'main' into 23-sort-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Elnageeb authored Jan 8, 2025
2 parents 68f62c1 + 1c7c129 commit 1d0ada4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions solutions/factorial_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-
"""
Module Name: factorial_calculator
Description: This module provides a function to calculate the factorial of a given number.
It uses a recursive approach to compute the factorial.
The module includes: the following function:
- factorial_calculator(num): Returns the factorial of the input number num.
Expand All @@ -15,7 +15,7 @@

def factorial_calculator(num: int | float) -> int:
"""
This function calculates the factorial of a non-negative integer or whole float using recursion.
This function calculates the factorial of a non-negative integer or whole float.
The factorial of a non-negative integer n is the product of all positive integers
less than or equal to num until we reach one.
Expand Down Expand Up @@ -64,6 +64,6 @@ def factorial_calculator(num: int | float) -> int:
if num == 1: # Base case 2
return 1 # turn-around 2

# Recursive case: factorial(num) = num * factorial(num-1)
# Recursive case: factorial_calculator(num) = num * factorial_calculator(num-1)
# breaking-down num | Build-up by multiplying
return num * factorial_calculator(num - 1)

0 comments on commit 1d0ada4

Please sign in to comment.