Skip to content

Instantly share code, notes, and snippets.

@anthonymorast
Last active January 8, 2022 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonymorast/7f0f18cbb58af1988736475123ab6ed9 to your computer and use it in GitHub Desktop.
Save anthonymorast/7f0f18cbb58af1988736475123ab6ed9 to your computer and use it in GitHub Desktop.
serial_square.py
import time
def square(x):
return x*x
if __name__ == '__main__':
start = time.time()
values = [i for i in range(10000000)]
squares = []
for value in values:
squares.append(square(value))
end = time.time()
print(f"Time Taken: {(end - start):.6f} sec/{((end-start)/60):.6f} min")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment