Python 3 Tutorial


Version 3.0 of Python, often referred to as Python 3000, or Py3k for short. This is a larger upgrade than the previous version of Python. In order not to introduce too much cumbersome, Python 3.0 was not designed to be backward compatible. Python introduction and installation tutorials are covered in the Python 2.X version of the tutorial , so I won't go into details here.

View python version

We can use the following command to view the version of Python we are using in the command window (Windows uses win+R to bring up the cmd run box):

python -V

The above command execution results are as follows:

Python 3.3.2

You can also go into Python's interactive programming mode and view 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 intro programming code is "Hello World!", the following code is to output "Hello World!" using Python:

Instance (Python 3.0+)

#!/usr/bin/python3 print("Hello, World!")

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

$ python3 hello.py 

The output of the above command is:

Hello, World!

welookups is optimized for learning.© welookups. 2018 - 2020 All Right Reserved and you agree to have read and accepted our term and condition.