in seconds since some arbitrary starting point by calling this function twiceat the beginning and at the endand then computing the differencewe can get an exact number of seconds (fractions in most casesfor execution import time def sum_of_n_ ( )start time time(the_sum for in range( + )the_sum the_sum end time time(return the_sum,end-start this code shows the original sum_of_n function with the timing calls embedded before and after the summation the function returns tuple consisting of the result and the amount of time (in secondsrequired for the calculation if we perform invocations of the functioneach computing the sum of the first integerswe get the followingfor in range( )print("sum is % required % secondssum_of_n_ ( )sum is required seconds sum is required seconds sum is required seconds sum is required seconds sum is required seconds againthe time required for each runalthough longeris very consistentaveraging about times more seconds for equal to we getfor in range( )print("sum is % required % secondssum_of_n_ ( )sum is required seconds sum is required seconds sum is required seconds sum is required seconds sum is required seconds in this casethe average again turns out to be about times the previous now consider the following codewhich shows different means of solving nthe summation problem this functionsum_of_n_ takes advantage of closed equation = ( )( + what is algorithm analysis