Version 3.0 of Python, often referred to as Python 3000, or Py3k for short. This is a major upgrade from earlier versions of Python. In order not to bring too much burden, Python 3.0 was not designed with backward compatibility in mind.
It is officially announced that on January 1, 2020, the update of Python 2 will be stopped.
Check Python version
We can use the following command in the command window (windows use win+R to bring up the cmd run box) to see which version of Python we are using:
python -V or python --version _ _
The result of executing the above command is as follows:
Python 3.3.2 _ _
You can also enter Python’s interactive programming mode, check the version:
Python 3.3.2 (v3.3.2:d047928ae3f6, March 28 2022, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>>
The first Python3.x program
For most programming languages, the first introductory programming code is “Hello World!”, the following code prints “Hello World!” in Python:
Example (Python 3.0+)
#!/usr/bin/python3 print("Hello, World!")
You can save the above code in hello.py file and execute the script file using python command.
$ python3 hello.py
The output of the above command is:
Hello , World !