I have been learning python3 recently. There is a problem when I try to use Sublime REPL to interpret my codes and I haven't figured out how to solve it. Much appreciate it if someone can help me!
When I try to write a simple input statement, everything works fine with the SublimeText REPL interpreter.
number1 = input('number1')
number2 = input('number2')
print(number1)
But there is a syntax error when I try to print the result. I could not find any syntax error by myself since I am following the book . Codes as shown below:
number1 = input('number1')
number2 = input('number2')
result = int(number1) - int(number2)
print(f'Number1 - Number2 = {result}')
Here is the error:
File "test.py", line 4
print(f'Number1 - Number2 = {result}')
^
SyntaxError: invalid syntax
edit: When I type on SublimeText:
import sys
print(sys.version)
The output is
3.9.7 (v3.9.7:1016ef3790, Aug 30 2021, 16:39:15)
I assume maybe SublimeText REPL is not running the latest version. Does anyone know how to update the REPL python version?
The problem has been solved, thanks to @alec_djinn and the community.
In my case, I followed the steps from coderwall.com/p/nhq2gg/setting-up-sublimerepl-with-python3
It seems the syntax error occurs because of SublimeText REPL is not running the correct version of python that was installed in the system.