Hello, I cannot figure out what is wrong with my code. can someone please help? please see below:
{moderator edit - solution code removed}
Hello, I cannot figure out what is wrong with my code. can someone please help? please see below:
{moderator edit - solution code removed}
Indentation is part of the syntax in python. Because all the lines that you intended to be part of the function are at the same indentation level as the function definition, they are not really part of the function. That wasn’t an actual syntax error until you got to the “return” statement, which only makes sense as part of a function body.
Can I just remove “return” then? I’m not sure I understand the solution.
No, you are building a function here that needs to return the cost value that you are computing, right? That’s the whole point.
You need to fix the indentation: all the lines that are part of the body of the function need to be indented one more tab than the function definition itself. That’s what I was trying to say in my previous reply.
That doesn’t seem to work for me.
We need to share source, so I will contact you by DM.