Hello!
I am doing one of the Google foobar challenges and my code returns the right values in my IDE, but not in foobar. I'm new to python and think I'm missing something on how foobar reads the code or calls the function. Help is much appreciated!
Here's my code:
Test cases:
Input:
solution.solution(15324)
Output:
15129,169,25,1
Input:
solution.solution(12)
Output:
9,1,1,1
I've read that foobar used the 'static method' but I'm not quite sure what that means or how it applies. No error information is provided by foobar.
As a note, if I enter this into foobar, it says Test 2 passes:
I am doing one of the Google foobar challenges and my code returns the right values in my IDE, but not in foobar. I'm new to python and think I'm missing something on how foobar reads the code or calls the function. Help is much appreciated!
Here's my code:
def solution(area): totalarea=int(area) sq1calc=abs(totalarea ** 0.5) sq1 = int(sq1calc) sq1area = sq1 ** 2 sq2calc=abs((totalarea - sq1area) ** 0.5) sq2 = int(sq2calc) sq2area = sq2 ** 2 sq3calc=abs((totalarea - sq1area - sq2area) ** 0.5) sq3 = int(sq3calc) sq3area = sq3 ** 2 sq4calc=abs((totalarea - sq1area - sq2area - sq3area) ** 0.5) sq4 = int(sq4calc) sq4area = sq4 ** 2 print(sq1area,sq2area,sq3area,sq4area, sep=",") solution()Two test case input/outputs are provided and my code runs these fine in my IDE.
Test cases:
Input:
solution.solution(15324)
Output:
15129,169,25,1
Input:
solution.solution(12)
Output:
9,1,1,1
I've read that foobar used the 'static method' but I'm not quite sure what that means or how it applies. No error information is provided by foobar.
As a note, if I enter this into foobar, it says Test 2 passes:
def solution(area): print ("""9,1,1,1""")