curriculum/challenges/english/blocks/daily-coding-challenges-python/68c1a929005bf54d342aa8d4.md
For day three of Space Week, you are given an array of numbers representing distances (in kilometers) between yourself, satellites, and your home planet in a communication route. Determine how long it will take a message sent through the route to reach its destination planet using the following constraints:
send_message([300000, 300000]) should return 2.5.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(send_message([300000, 300000]), 2.5)`)
}})
send_message([384400, 384400]) should return 3.0627.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(send_message([384400, 384400]), 3.0627)`)
}})
send_message([54600000, 54600000]) should return 364.5.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(send_message([54600000, 54600000]), 364.5)`)
}})
send_message([1000000, 500000000, 1000000]) should return 1674.3333.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(send_message([1000000, 500000000, 1000000]), 1674.3333)`)
}})
send_message([10000, 21339, 50000, 31243, 10000]) should return 2.4086.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(send_message([10000, 21339, 50000, 31243, 10000]), 2.4086)`)
}})
send_message([802101, 725994, 112808, 3625770, 481239]) should return 21.1597.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(send_message([802101, 725994, 112808, 3625770, 481239]), 21.1597)`)
}})
def send_message(route):
return route
def send_message(route):
total_distance = sum(route)
delay = (len(route) - 1) * 0.5
time = total_distance / 300_000
total = time + delay
return round(total, 4)