Invalid Syntax in Reviews: Functions ...please advise!


#1

Continuing the discussion from I am stuck in the "17.Reviews:Functions" two days!:

I’ve been stuck on this problem for quite a while. Is the problem related to my spacing/indents? Did I misplace the : within my definition? I can’t spot the issue :man_shrugging:


#2

Hi @cannonball_g,

It appears that you’re checking if s is equal to a string; however, a string is not passed into s.

Hope this helps! Feel free to reply if otherwise. :smile:


#3

In other words cannonball_g he is just asking you too place quotations around the object you are passing to s to notate it as a string.


#4

Thanks humanoptimization. I’m getting closer to the solution, but I’m not sure what the “object” is. Shut_down is the function, and I tried putting quotes around that. I don’t have any other variables involved, I can’t see what’s missing if I compare to the example code :thinking:


#5

Your object is what you are passing to the function so in this scenario it would be the string ‘yes’ which in your code is missing quotations to notate it as a string.

print shut_down(yes) -> incorrect
vs
print shut_down(‘yes’) -> correct


#6

I see what you’re saying, that makes total sense, but my code isn’t making it past line 3 because of an IndentationError: unindent does not match any outer indentation level. I’ve tried adjusting the indent level in every way possible but I’m still getting the same error. I’m also somewhat confused on return vs print, wondering if that is causing problems.


#7

Yea brother, throw in a print statement instead of return. Also take everything back a TAB looks like in the screenshot its a double tab.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.