sys.version_info

A value in the sys module that tells a running program exactly which Python version it is, as major, minor and micro numbers.

In more detail

It behaves like a tuple, so you can compare it, for example sys.version_info >= (3, 10). The course uses it to ask the interpreter about itself rather than guessing. sys.version gives the same information as a longer string including build details.

Example

import sys
print(sys.version_info)

Related terms

Taught in

References