Created
April 30, 2020 13:22
-
-
Save CITGuru/cc5dbf4f794ea7b5a40a0a2d2db97d12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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