...
...
Python codes can be run by the Python Interpreter in interactive mode or program mode.
(1) Interactive Mode
To run in interactive mode, open a terminal window (refer here) and type "python" or "py" as shown below (in the orange highlighted codes).
PS C:\ZTP> python Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print ("hello world") hello world
Python will execute the statement on-the-fly.
To exit Python command-line interpreter mode, type exit()
(2) Program Mode
To run in module mode, create a script file e.g. "hello.py" that contains Python statements and then call python program to execute the script file.
(In the Visual Code, right-click the project file name, select New File...)
Type the following codes and then save.
print ("hello world")
Run the script file by typing the following codes.
python hello.py
(3) Online Coding
Alternatively, go to Trinket.io and use the online editor to start writing your first python codes, without even installing anything into your local machine.
If you are looking for a more serious online IDE, goto colab.research.google.com and start exploring data science and machine learning in Python.
Further Reading:
https://www.tomshardware.com/how-to/create-python-executable-applications
0 Comments