Space Python Loading Python…

Tuple Unpacking

 
0:00 / 0:00

Challenge

Practise what this example shows with these challenges.

Landing site

Write the codeEasy 2 stages

Store the Perseverance landing site as a (lat, lon) tuple, unpack it into two variables in one line and print both to four decimals, then show it the way maps do, with N, S, E and W.

Start the challenge

Manifest line

Write the codeEasy 2 stages

Unpack an (id, item, mass_kg) tuple into three named variables and print a cargo manifest line, then fix the ValueError when the manifest adds a fourth field.

Start the challenge

Discussion

Stuck on this example or want to go further? Ask here, or see what others asked.

Log in to ask and reply.

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:].