Write a function to print the time taken by a calc function to ferform a simple multiplication 10 Million time


Topic: Write a function to print the time taken by a calc function to ferform a simple multiplication 10 Million time

Solution

def time_calc(n: int):
    import time
    start = time.perf_counter()
    for i in range(10000000):
        n*2
    end = time.perf_counter()
    return end-start



List all Python Programs