I ran into a curious issue while doing these challenges on codecademy. Each time i copy and paste the solution given it comes up with an error message. Usually the same error message. I am unsure what is wrong with the syntax that is creating th error. Any feedback would be greatly appreciated.
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!
The problem is that there are invisible characters in the snippets, specifically the character U+00A0 (Non-breaking space) instead of spaces.
A good editor or IDE will show these hidden/invisible characters and allow you ways to remove/replace them. However, if you don’t have one at hand, you can copy paste the code, assign it to a variable as a multi-line string (using a pair of three quotes) and then print its repr:
As you can see in the screenshot, there are a number of \xa0 characters which appear as normal spaces to the naked eye. The Unicode \xa0 represents non-breaking space.
We see uniques on the screen, but in reality the copied code is \xa0\xa0uniques which includes characters not allowed in Python variable names. Hence, the SyntaxError: invalid character in identifier message.