+ 1

invalid syntax

letters=[‘a’, ’b’, ’z’] if (“2”) in letters: print (“YES”) Result: File "<string>", line 2 letters=[‘a’, ’b’, ’z’] ^ SyntaxError: invalid syntax

2nd Aug 2019, 4:30 AM
Алексей Афанасьев
Алексей Афанасьев - avatar
3 Answers
+ 9
You have a font problem. The code itself is working.
2nd Aug 2019, 4:38 AM
Mikhail Gorchanyuk
Mikhail Gorchanyuk - avatar
+ 6
You are using slanted quotation marks - possibly you pasted the code from a Word document? If you are coding outside a code editor, use plain text. letters = ['a', 'b', 'z'] if "2" in letters: print("YES 2") if "a" in letters: print("YES a")
2nd Aug 2019, 4:50 AM
David Ashton
David Ashton - avatar
same as mine,but the font is correct
2nd Aug 2019, 4:55 AM
prisma - avatar