Space Python Loading Python…

Functions with Parameters

 
0:00 / 0:00

Challenge

Practise what this example shows with these challenges.

Sort by a field

Write the codeEasy 2 stages

Sort launches by date with sorted() and a small function that returns each launch's date, then sort the cargo manifest heaviest first with a key function and reverse=True.

Start the challenge

Changed the caller's list

Fix the codeMedium 3 stages

add_reading() appends to the list it receives, so the caller's stored readings change too. Predict the first line, prove both names share one list, fix it by returning a new list, then write a filter that leaves its input alone.

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