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:
totarea=int(area)
sq1calc=abs(totarea ** 0.5)
sq1 = int(sq1calc)
sq2calc=abs((totarea - (sq1 ** 2)) ** 0.5)
sq2 = int(sq2calc)
sq3calc=abs(((totarea - (sq1 ** 2) - (sq2 ** 2))) ** 0.5)
sq3 = int(sq3calc)
sq4calc=abs(((totarea - (sq1 ** 2) -sq2 ** 2)- (sq3 ** 2)) ** 0.5)
sq4 = int(sq4calc)
print(sq1,sq2,sq3,sq4, 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.
Aucun commentaire:
Enregistrer un commentaire