Question 1 of 30
In a software development project, a team is tasked with creating a Python function that calculates the factorial of a number. The function must handle both positive integers and zero, returning the factorial value. If the input is a negative integer, the function should raise a ValueError. Given the following implementation of the function, identify the potential issues and the correct behavior of the function when provided with various inputs:
python
factorial(n):
n < 0:
se ValueError("Input must be a non-negative integer.")

Preparing for Microsoft 98-381 Introduction to Programming Using Python? 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