Program - show generator is faster than list


Topic: Program - show generator is faster than list

Solution

def show_gen_fast():
    from timeit import timeit
    dt = timeit("[num for num in fib(100) ]", globals = globals(), number=1)
    return dt



List all Python Programs