Question 1 of 30
In a software development project, a team is tasked with creating a function that calculates the factorial of a number. The function must handle both positive integers and zero, returning the correct factorial value. Additionally, the team needs to ensure that the function is efficient and does not exceed a maximum recursion depth of 1000 calls. Given the following implementation in Python, identify the potential issues and the best approach to optimize the function while maintaining correctness.
python
factorial(n):
n < 0:
urn "Error: Negative input"

Preparing for CISCO 200-901 Developing Applications and Automating Workflows using Cisco Core Platforms (DEVASC)? Now land the interview.

73% of qualified candidates get rejected because of weak resumes. Build an ATS-optimized, recruiter-ready resume in under 5 minutes - free to start.

Build My Resume Free