Question: For Homework 3 , you had to make two different function to calculate factorials. One used a for loop, and one used a recursive function

For Homework 3, you had to make two different function to calculate factorials. One
used a for loop, and one used a recursive function that called itsself.
A) Which of these function was faster for calculating large factorials? (Say,100!) You'll
needed to use
import timeit
or something similar to time the two functions.
B) What is the largest factorial your functions can calculate as a floating point number,
before they return infinity? You might need to modify your factorial function to return a
float by setting the initial number (0!) to 1.0 instead of 1In []:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!