the_sum the_sum return the_sum print(sum_of_n( )now look at the function foo below at first glance it may look strangebut upon further inspection you can see that this function is essentially doing the same thing as the previous one the reason this is not obvious is poor coding we did not use good identifier names to assist with readabilityand we used an extra assignment statement during the accumulation step that was not really necessary def foo(tom)fred for bill in range( tom+ )barney bill fred fred barney return fred print(foo( )the question we raised earlier asked whether one function is better than another the answer depends on your criteria the function sum_of_n is certainly better than the function foo if you are concerned with readability in factyou have probably seen many examples of this in your introductory programming course since one of the goals there is to help you write programs that are easy to read and easy to understand in this coursehoweverwe are also interested in characterizing the algorithm itself (we certainly hope that you will continue to strive to write readableunderstandable code algorithm analysis is concerned with comparing algorithms based upon the amount of computing resources that each algorithm uses we want to be able to consider two algorithms and say that one is better than the other because it is more efficient in its use of those resources or perhaps because it simply uses fewer from this perspectivethe two functions above seem very similar they both use essentially the same algorithm to solve the summation problem at this pointit is important to think more about what we really mean by computing resources there are two different ways to look at this one way is to consider the amount of space or memory an algorithm requires to solve the problem the amount of space required by problem solution is typically dictated by the problem instance itself every so oftenhoweverthere are algorithms that have very specific space requirementsand in those cases we will be very careful to explain the variations as an alternative to space requirementswe can analyze and compare algorithms based on the amount of time they require to execute this measure is sometimes referred to as the "execution timeor "running timeof the algorithm one way we can measure the execution time for the function sum_of_n is to do benchmark analysis this means that we will track the actual time required for the program to compute its result in pythonwe can benchmark function by noting the starting time and ending time with respect to the system we are using in the time module there is function called time that will return the current system clock time algorithm analysis