can not run python on sublime text | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can not run python on sublime text

Anyone can help me. I am a beginner. I can not run code like 2 + 3 on subline text. but other codes like print can do.

3rd Jun 2018, 1:11 PM
Ming Lu
Ming Lu - avatar
11 Answers
+ 1
what do you mean by run on sublime text? python codes are run by the python interpreter. could you give specific code that fails and tell us how you are trying to run the code
3rd Jun 2018, 1:26 PM
Max
Max - avatar
+ 1
Ming Lu maybe you are trying to see the output of code written using sublime text. Maybe you see the output of prints but not the output of expressions like: 2 + 3 The problem: None! expressions like that are interpreted and printed out only in the interactive interpreter.
3rd Jun 2018, 1:30 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
if you don‘t print the result nothing will be printed, seeing the result of your expressions is a feature that is only in the interactive python sessions
3rd Jun 2018, 1:30 PM
Max
Max - avatar
+ 1
run this in sublime: print(5+3)
3rd Jun 2018, 1:37 PM
Max
Max - avatar
0
Hi, thanks for your reply. In terminal on Mac, I can use 2 + 3 and then press Enter, the result is 5. I can not do it the same way in Sublime Text
3rd Jun 2018, 1:28 PM
Ming Lu
Ming Lu - avatar
0
Python 3 has been already added to sublime text
3rd Jun 2018, 1:29 PM
Ming Lu
Ming Lu - avatar
0
And I pressed Command + B in Sublime Text.
3rd Jun 2018, 1:30 PM
Ming Lu
Ming Lu - avatar
0
So it means this kind of calculation can not run in Sublime text?
3rd Jun 2018, 1:34 PM
Ming Lu
Ming Lu - avatar
0
Ming Lu you just have to print the result
3rd Jun 2018, 1:35 PM
Max
Max - avatar
0
Then, can you tell me how to do such calculation and print the result in Sublime text? thanks a lot.
3rd Jun 2018, 1:36 PM
Ming Lu
Ming Lu - avatar
0
Got it. Thanks very much.
3rd Jun 2018, 1:39 PM
Ming Lu
Ming Lu - avatar