Peter wrote the factorial function and now he wants to analyze the performance of his code. For this, he wants to use the cProfiler module from Python. The problem is that, somehow, he messed up the lines in his code. Can you help him? Arrange the lines so the code below becomes valid.
Profiling in Python
Factorial profiler
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
return n * factorial(n-1)
return 1
def factorial(n):
import cProfile
cProfile.run("factorial(30)")
else:
if n == 0:
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.