Python Get Started
Learn all about Python Get Started in this comprehensive tutorial.
- •At PythonWorld, you can try Python without installing anything.
- •However, if you want to run Python on your own computer, follow the instructions below.
- •Python is an interpreted programming language, this means that as a developer you write Python (.
- •To check the Python version of the editor, you can find it by importing the sys module:
- •To test a short amount of code in python sometimes it is quickest and easiest not to write the code in a file.
Get Started With Python
At PythonWorld, you can try Python without installing anything.
Our Online Python Editor runs directly in your browser, and shows both the code and the result:
This editor will be used in the entire tutorial to demonstrate the different aspects of Python.
Python Install
However, if you want to run Python on your own computer, follow the instructions below.
Many Windows PCs and Mac computers already have Python pre-installed.
To check if Python is installed on Windows, search in the start bar for Python or run the following on the Command Line (cmd.exe):
To check if you have python installed on a Linux or Mac, then on linux open the command line or on Mac open the Terminal and type:
If Python is not installed on your computer, you can download it for free from the official website: https://www.python.org/
Python Quickstart
Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed.
Let's write our first Python file, called hello.py, which can be done in any text editor:
Simple as that. Save your file. Open your command line, navigate to the directory where you saved your file, and run:
The output should be:
Congratulations, you have written and executed your first Python program.
Python Version
To check the Python version of the editor, you can find it by importing the sys module:
You will learn more about importing modules in our Python Modules chapter.
The Python Command Line
To test a short amount of code in python sometimes it is quickest and easiest not to write the code in a file. This is made possible because Python can be run as a command line itself.
Type the following on the Windows, Mac or Linux command line:
From there you can write any python code, including our hello world example from earlier in the tutorial:
Which will write "Hello, World!" in the command line:
Whenever you are done in the python command line, you can simply type the following to quit the python command line interface:
Module quiz
2 questionsWhich of the following is true about Python Get Started?
What is the most common pitfall when working with Python Get Started?
Answer all questions to submit.