Beautiful people of SO,
I have been battling a Kata on codewars.com and I am unable to determine what I am doing wrong in the following 'if' statement:
def find_time_to_break(bearing_A, bearing_B):
ships_angle = math.cos(abs(bearing_A - bearing_B)
if ships_angle != 180:
return round((40/(2*(math.sin(ships_angle/2)))/90*60, 2)
elif ships_angle == 180:
return 13.33
return float('inf')
Since the website contains the compiler for Python, I am including a screenshot of the error I am getting (result/error of my code in the left window, my code in the right window). I have tried rewriting the code in several ways, including a one-line return code but I keep getting shoved off by 'invalid syntax' error.
Those who are familiar with codewars.com, I have left name of the kata disclosed in the screenshot.
I am grateful for any advice or nudge in the right direction. I am also open to other suggestions regarding my overall code-writing as I learnt the programming basics by creating Excel macros using VBA and my current style is not 'pythonic.'
Aucun commentaire:
Enregistrer un commentaire