From 2004b81dd4bb5e5a864b7911b407b4beb54972fe Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Thu, 5 Sep 2019 10:00:29 +0200 Subject: [PATCH] exe 1 solution takes 1 sec --- 1_problem.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/1_problem.py b/1_problem.py index 03ecc38..9a371cb 100644 --- a/1_problem.py +++ b/1_problem.py @@ -1,10 +1,20 @@ from dask import delayed # DON'T CHANGE (explained later) +import time +import math def func(i): """A dummy CPU-bound function.""" print(f'Function {i} starting...') # ***INSERT CODE HERE*** (should take about 1 second to execute) + for i in range (800000000): + i += math.sqrt(2) print(f'Function {i} done') return i -lazy = [delayed(func)(i) for i in range(4)] # DON'T CHANGE (explained later) \ No newline at end of file + +start = time.time() + +lazy = [delayed(func)(i) for i in range(4)] # DON'T CHANGE (explained later) + +end = time.time() +print("it took {} seconds".format(end - start))