Space Python Loading Python…

Ground station pick

Write the codeEasy 2 stages

ESA talks to its deep-space missions through three big antennas spread around the world: New Norcia in Australia, Cebreros in Spain and Malargüe in Argentina. As the Earth turns, the spacecraft rises over one and sets behind another, so the scheduler picks the station by the longitude on Earth right under the spacecraft.

Pick the station from the longitude, then make the scheduler cope with longitudes written the other common way.

Each station covers a band of longitudes. Pick the one the spacecraft is over and print it:

from 60 to 180       New Norcia
from -60, below 60   Cebreros
below -60            Malargüe

For 100.0 it's Ground station: New Norcia. Go through the bands from east to west, so each elif only needs its lower limit, and store the name in station before printing it.

Pick the station
Right in every band

Finish stage 1 to unlock this stage.

Some tools write longitudes from 0 to 360 instead of from -180 to 180: 296 means 64 degrees west. The starter code picks New Norcia for 296, which is wrong. Before choosing, turn anything over 180 into the usual form by subtracting 360, and reject values that can't be longitudes at all, outside -180 to 360:

Ground station: Malargüe
Invalid longitude: 400.0

For 296.0 it prints the first line. Check for impossible values first; only a valid longitude gets converted and gets a station.

Accept 0 to 360
Reject impossible values
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

If-elif-else Statement

if-elif-else-statement.py
# Oxygen level on a space station
oxygen = 19.5

if oxygen >= 23:
    status = "Warning: fire risk"
elif oxygen >= 19.5:
    status = "Normal"
elif oxygen >= 16:
    status = "Low"
else:
    status = "Critical"

print(status)

# Signal delay from a deep space probe
delay = 14.0  # minutes

if delay < 1.3:
    location = "Near the Moon"
elif delay < 5:
    location = "Inner solar system"
elif delay < 25:
    location = "Outer planets region"
else:
    location = "Deep space"

print(f"Delay: {delay} min - {location}")
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:].