⚙️Appendix A

This appendix provides a comprehensive guide on best practices, detailed troubleshooting techniques, and an assortment of useful code snippets.

import sys  # Import the sys module to access system-specific parameters and functions

# Print the Python version to the console
print("Python version")

# Use the sys.version attribute to get the Python version and print it
print(sys.version)

# Print information about the Python version
print("Version info.")

# Use the sys.version_info attribute to get detailed version information and print it
print(sys.version_info)

Save the file as Ver.py, then execute the program using the command below:

$ python Ver.py

And the output will look like this:

Python version
3.12.1 (main, Dec  8 2023, 18:57:37) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Version info.
sys.version_info(major=3, minor=12, micro=1, releaselevel='final', serial=0)

Last updated