Easy Tutorial
❮ Python Loop Python Att List Insert ❯

Python 3 Tutorial

The 3.0 version of Python, often referred to as Python 3000, or simply Py3k, represents a significant upgrade from earlier versions of Python. Python 3.0 was designed without consideration for backward compatibility to avoid carrying unnecessary baggage.

An introduction to Python and installation instructions have already been covered in our Python 2.X version tutorial, so we will not repeat that here.

You can also click Python 2.x vs 3.x Version Differences to see the differences between the two versions.

This tutorial primarily targets learning Python 3.x. If you are using Python 2.x, please refer to the Python 2.X version tutorial.

Official announcement: Python 2 updates will cease on January 1, 2020.


Checking the Python Version

You can view the Python version you are using in the command window (use Win+R to open the cmd prompt on Windows) with the following commands:

python -V
or
python --version

The result of the above command is as follows:

Python 3.3.2

You can also enter Python's interactive programming mode to check the version:

Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>

The First Python 3.x Program

For most programming languages, the first introductory code is "Hello World!". The following code uses Python to output "Hello World!":

hello.py File Code:

#!/usr/bin/python3

print("Hello, World!")

The common file extension for Python is .py.

You can save the above code in a file named hello.py and execute the script file using the python command.

$ python3 hello.py

The result of the above command is:

Hello, World!

Related Content:

Python 3.6.3 Chinese Manual

Python 2.X Version Tutorial

❮ Python Loop Python Att List Insert ❯