today’s challenge on Space Week Day 3: Phone Home. Below is my solution using Python. But I did not get any of the tests. Could there be a bug?
def send_message(route):
Distance = 0
for i in range(len(route)):
Distance += route[i]
time = (Distance / 300000) + (0.5 * (len(route) - 1))
formatted = f"{time:.4f}".rstrip('0').rstrip('.')
return formatted
Your indentation is not correct
Indentation issue fixed now. Still not getting the tests.
What is your latest code?
Oh, you edited the first post. Note, that is a little confusing for people who like reading posts in linear time.
You still have indentation problems
okay. could you point me in the right direction
how about this now. I have corrected the indentation.
Is that time delay at each satellite correct?
Oh you aren’t returning the required string.
I am sure the required string is where the issue is. Could you help with the correct return string
Look at the tests cases. They have examples of the exact return values expected.
You are returning the output as a string instead of a number. Returning float(formatted) will pass the test cases.
Thanks. All tests cases passed
2 Likes