You're online now.

Hurray! you are online now.

Write a python program to get the python version you are using

// Write a python program to get the python version you are using.
    import sys
    print("Python version")
    print(sys.version)
    print("Version information.")
    print(sys.version_info)
    

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.

  1. ‘import sys’: This line import the ‘sys’ module, which provides access to some variables and functions that interact with the Python interpreter.
  2. 'print("Python version")': This line simply prints the string "Python version" to the console(terminal).
  3. '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.
  4. 'print("Version information.")': This line print the string "Version information." to the console(terminal).
  5. '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.
🖤 0
Buy me coffee ☕

Comments

Oops!

No comments here...