Python Exercise: Write a program to get execution time (in seconds) for a Python method
(Python Example for Citizen Data Scientist & Business Analyst) Write a program to get execution time (in seconds) for a Python method. Sample Solution Python Code: import time def sum_of_n_numbers(n): start_time = time.time() s = 0 for i in range(1,n+1): s = s + i end_time = time.time() return s,end_time-start_time n = 5 print(“nTime … Continue reading Python Exercise: Write a program to get execution time (in seconds) for a Python method
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed