Space Python Loading Python…

Return Statement Basics

 
0:00 / 0:00

Challenge

Practise what this example shows with these challenges.

Prints instead of returns

Fix the codeEasy 3 stages

to_kelvin() prints its result instead of returning it, so the caller gets None. Predict the last line, find out what the function gives back, fix it with return, then write a conversion function that returns.

Start the challenge

Edge cases

Write the codeMedium 2 stages

Write assert checks for mean(): an ordinary list and a list with one value first, then the edge cases, an empty list that should give None and lists with negative values, so broken copies of the function can't pass.

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