// Write a python program to get the python version you are using.
This code used the ‘sys’ module in python to print the version of Python that is currently installed on your system, as well as additional information.
- ‘import sys’: This line import the ‘sys’ module, which provides access to some variables and functions that interact with the Python interpreter.
- 'print("Python version")': This line simply prints the string "Python version" to the console(terminal).
- 'print(sys.version)': This line of code prints the version of Python that is currently installed on your system, as reported by 'sys.version'. The output of this line of will look something like 3.9.0 (default, Oct 6 2020, 00:00:00) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.45)], indicating the Python version, the build date, and the compiler used to build it.
- 'print("Version information.")': This line print the string "Version information." to the console(terminal).
- 'print(sys.version_info)': This line prints out additional version information about the Python installation, in the form of a named tuple. The output of this line will look something like: sys.version_info(major=3, minor=9, micro=0, releaselevel='final', serial=0), indicating the major, minor, and micro version numbers of Python, the release level (which can be "alpha", "beta", "candidate", or "final"), and the serial number.