AiPromptss
Back to browse

Basic Code Review

Please review this Python function that calculates factorial : def factorial ( n ) : if n < 0 : return None if n == 0 : return 1 return n * factorial ( n - 1 )…

Added May 19, 20260 views0 copies
Prompt
Please review this Python function that calculates factorial
:
def
factorial
(
n
)
:
if
n
<
0
:
return
None
if
n
==
0
:
return
1
return
n
* factorial
(
n
- 1
)
Focus on
:
1.
Error handling
2.
Performance
3.
Edge cases
4.
Coding standards

Replace text in [BRACKETS] with your own values before pasting.