Space Python Loading Python…

Downlink time

Write the codeMedium 3 stages

A small CubeSat stores its images on board and sends them down whenever it passes over a ground station. Before each pass, the ground team works out how long a download will take and how many passes it needs.

Write their calculator: read the file size and the link speed, work out the transfer time, then plan it pass by pass.

File sizes are measured in bytes, but link speeds in bits, and a byte is 8 bits. Ask for the file size in MB, then the link speed in Mbit/s, both as decimal numbers, and print the transfer time in minutes with one decimal place. For a 450 MB file at 2 Mbit/s:

Downlink time: 30.0 min

Forget the 8 and the answer still looks reasonable, just eight times too short. That's the trap this stage is about.

Print the transfer time
Works for any file

Finish stage 1 to unlock this stage.

The ground team schedules downloads to the second. Show whole minutes and seconds instead, rounding to the nearest second first. For a 1250 MB file at 6 Mbit/s:

Downlink time: 27 min 47 s

The same trick as in "Signal delay": round, then split with // and %.

Show minutes and seconds
Works for any file

Finish stage 2 to unlock this stage.

A satellite in low orbit only sees the ground station for about 10 minutes per pass, so a long download is split over several passes. Add PASS_S = 600 next to the other constant and print how many passes the file needs:

Downlink time: 27 min 47 s
Ground station passes: 3

A download that takes exactly 30 minutes fits into 3 passes, not 4. Round up the same way as in "Packing crates".

Count the passes
Round the passes up correctly
You're not logged in, so your progress is kept in this browser only. Log in to save it, and to use hints and solutions.

Hints

Basic Math Operations

basic-math-operations.py
# Mission fuel calculation
fuel_total = 1000
fuel_used = 350

fuel_remaining = fuel_total - fuel_used
print("Remaining fuel:", fuel_remaining, "liters")

# Engine power output
engines = 4
power_per_engine = 250

total_power = engines * power_per_engine
print("Total power:", total_power, "kW")

# Average speed calculation
distance = 1000
time_hours = 4

speed = distance / time_hours
print("Speed:", speed, "km/h")
Open the full example
script.py
PythonLn 1, Col 1Spaces: 4
Loading the Python environment…

Separate arguments with commas. They're passed on every Run as sys.argv[1:].