Skip to content

Instantly share code, notes, and snippets.

@CITGuru
Created April 30, 2020 13:22
Show Gist options
  • Save CITGuru/cc5dbf4f794ea7b5a40a0a2d2db97d12 to your computer and use it in GitHub Desktop.
Save CITGuru/cc5dbf4f794ea7b5a40a0a2d2db97d12 to your computer and use it in GitHub Desktop.
import timeit
print("Toby")
print("https://gist.github.com/CITGuru/699a5513e82cc610884cb61c7c4509ab")
code_to_test = """
import math
def solution(area):
a = []
while area >= 1 and area<=1000000:
square = math.pow(math.floor(math.sqrt(area)), 2)
area = area - square
a.append(int(square))
return a
print(solution(15324))
print(solution(12))
print(solution(2982))
print(solution(9))
"""
elapsed_time = timeit.timeit(code_to_test, number=1)/100
print("Code took: ", elapsed_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment