17/19 - Syntax Error


#1

imagefile:///home/luke/Pictures/17.19.png

Hi everyone,
I’m having a bit of trouble with this exercise. I’ve had a read through some of the other posts on it but I still don’t understand what my problem is, apologies if this has been covered already.

I don’t understand how my syntax can be off for elif when it’s the same syntax I used for if. As far as I can tell my indentation is ok.

Can anyone shed one light on this for me?

Thanks a million,
Luke.


#2

Hi @arraysurfer01303,

As far as I can tell, your code looks correct. I’d try refreshing the page and then resubmitting it. If this doesn’t work try it on a different browser.


#3

“Shutting down” appears to have a non-standard opening quote.


#4

Are you sure @mtf? It looks like a standard opening quote (") to me. Correct me if I’m wrong, but there doesn’t appear to be any visible difference between it and the other two opening quotes.


Edit:

Upon further reflection, I believe you meant to say closing quote. As the closing quote on the aforementioned string does indeed appear to be non-standard.


#5

With my eyesight I cannot really tell. In any case there is something suspect in that line as indicated by where the error is thrown.


#6

Agreed.

If I were you, @arraysurfer01303, I would go ahead and just rewrite that line.


#7

Ok, just in case the screenshot isn’t clear, I’ve written that line with double quotes, so

return “Shutting down”

The error is being thrown on line 4 though, the next line.

Thanks for all your replies; I’m a rank beginner at this so I appreciate any and all help/suggestions.


#8

Looks like both quotes are non-standard. Replace that string with,

"Shutting down"

Notice the difference in the quotes?

Are these fancy quotes on a Mac?


#9

Like @mtf said, you currently have:

return “Shutting down”

The quotes you have used are non-standard and are therefore not recognised by the interpreter. You need to use standard quotes when coding, like this…

return "Shutting Down"

#10

Ah, I get you. These are the usual quotes for me, I’m running Ubuntu 14.04. I do see the difference, but they appear as standard quotes when I type in the python shell and there’s been no errors in any of the other lessons. Surely the error would appear in line 2 if the quotes were the problem?

I just downloaded a python shell for ubuntu and my code works fine in it, no errors or anything. I think I’ll just move on to the next lesson, it seems to be letting me.

Thanks for all the input everyone :slight_smile:


#11

The error indicator shows where the code stopped parsing, just before elif. That means the error is before that point, and the quotes are the issue.


#12

Apparently it’s’ something called “smart quotes”. From what I can tell, it would appear that the English Majors of the world would have us believe that the standard quotation marks we use in coding are “dumb” and should only be used for denoting measurements.

https://www.fonts.com/content/learning/fyti/typographic-tips/smart-quotes
http://smartquotesforsmartpeople.com/


#13

Seems the linter here and at repl.it need to be updated to recognize (and swap out) those quotes.


#15

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