Python 3 Tutorial


The 3.0 version 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 designed without considering backward compatibility.

View python version

We can use the following command to view the version of Python we use 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 enter Python's interactive programming mode to 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("< Span class="hl-string">Hello, World!")

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

$ python3 hello.py 

The output of the above command is:

Hello, World!

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