Return command Python Data Analysis Basics slide 7

Why does this function not require you to return “print(output)”? 33%20am

Hey there Cryptomass!

This function isn’t actually returning anything at all — it’s just running the code in the body. If you try to assign artist_summary("Henri Matisse" to a variable, the variable will contain a None object because there’s nothing being returned to assign.

So, in short, if you want to return an object that you can use elsewhere in your code (by assigning to a variable, for example), you’ll want to use the return statement. If you just want to output results, the return statement isn’t needed.

Hope that helps!

-Dee

1 Like