Pls provide solution to exercises in the Data Science course

I can’t seem to find the solution code to these exercises. I wanted to check my code against CC’s code. Can someone help direct me to where I can find the solution code?

This is what the prompt said:

" This article will help you review Python functions by providing some code challenges involving lists.

Some of these challenges are difficult! Take some time to think about them before starting to code.

You might not get the solution correct on your first try — look at your output, try to find where you’re going wrong, and iterate on your solution.

Finally, if you get stuck, use our solution code! However, truly investigate that solution — experiment and play with the solution code until you have a good grasp of how it is working. Good luck !"


There is no “solutions” button. Only a check answers button that returns the error.

For example: I just typed in def _____ ( ):

And then I clicked “check answer”

In the right hand box it provides this:

File "", line 7
SyntaxError: unexpected EOF while parsing

In the “check answers box” it provides this:

unexpected EOF while parsing (

There is no button that actually provides the CC solution for me to check my solution against. My solutions I am sure are way clunkier than CC’s solution so I would like to see how CC solves the problem and learn from it.

Here is my chat with someone from CC:

Your function has an invalid name, _____ can not be used as function name. As such, check answer (which validates your code) displays the underlying error thrown by the python interpreter.

the show solution (although i recommend not to use it) shows after several failed attempts.

As @stetim94 said, the “View Solution” option only appears after you’ve tried and failed a couple of times. This is to encourage you to attempt the problem yourself first, rather than simply asking for the answers.

The full body of text explains this: