Your issue isn't Sublime related and instead is related to the fact that you're expecting a REPL environment when there isn't one. This isn't unique to using Sublime and it's also not unique to Python.
REPL stands for Read, Evaluate, Print, Loop. What this means is that the environment expects you to enter a line of code, which it then evaluates, printing the result, then going back to ask you for more information. There are many environments that present themselves as a REPL, such as executing Python with no script, executing the NodeJS interpreter with no script, the development tools in your browser, etc.
While Python does indeed include a REPL environment, and some things like Jupyter present themselves that way, that doesn't apply to what you're trying to do here. What you're doing is creating a Python file and then asking the external Python interpreter "Please run this program". This does exactly that; the Python interpreter loads and compiles your script, then runs it from top to bottom, then stops.
The code in your example assigns a value to a variable and then just references the variable; there is no call to print()
to ask the Python interpreter to print the result of anything, so it doesn't. Instead it dutifully stores the value in the variable and then it's done.
More information on the REPL concept can be found here: https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…