Skip to content

Instantly share code, notes, and snippets.

@santosh
Created January 14, 2018 09:34
Show Gist options
  • Save santosh/4fb36461ff6d40c3bdd1c97350db745b to your computer and use it in GitHub Desktop.
Save santosh/4fb36461ff6d40c3bdd1c97350db745b to your computer and use it in GitHub Desktop.
import threading
import time
def calc_square(numbers):
print("calculate square numbers")
for n in numbers:
time.sleep(0.2)
print('square', n*n)
def calc_cube(numbers):
print("calculate cube numbers")
for n in numbers:
time.sleep(0.2)
print('cube', n*n)
arr = [2, 3, 8, 9]
t = time.time()
calc_square(arr)
calc_cube(arr)
print("done in: ", time.time() - t )
print("Hah.. I am done with all my works now!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment