0

I am starting to learn to program with Python in Sublime Text, so I am taking a course on YouTube. In one part he teaches this example to learn "if" and "else":

print ("Access verification")

user_age = int (input ("Please enter your age"))

if user_age <18:
   print ("You can't pass")
elif user_age> 100:
   print ("Incorrect age")
else:
   print ("You can pass")

print ("The program has ended")

But when I run the program (Tools> SublimeREPL> Python> RUN current file) I get this error:

File "conditionals2.py", line 1
SyntaxError: Non-ASCII character '\ xc3' in file conditionals2.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

*** Repl Closed *** This error only happens to me on Mac, if I run the exact same file on Windows it works. I already tried uninstalling and installing REPL but nothing happened

buran
  • 13,682
  • 10
  • 36
  • 61
  • Please post properly formatted code. This is especially important for Python due its indentation rules – DarkKnight Dec 21 '21 at 17:31
  • Is it possible that you use python2 instead of python3? – buran Dec 21 '21 at 17:40
  • Is the line `print ("Access verification")` the line 1 in `conditionals2.py`? – MSH Dec 21 '21 at 17:40
  • Does this answer your question? [Python NLTK: SyntaxError: Non-ASCII character '\xc3' in file (Sentiment Analysis -NLP)](https://stackoverflow.com/questions/26899235/python-nltk-syntaxerror-non-ascii-character-xc3-in-file-sentiment-analysis) –  Dec 21 '21 at 17:41
  • Remove all the spaces between print, int, input and their parentheses –  Dec 21 '21 at 17:46
  • https://stackoverflow.com/search?q=%5Bpython%5D+SyntaxError%3A+Non-ASCII+character – Ulrich Eckhardt Dec 21 '21 at 18:23

0 Answers0