sys
sys is a standard module that gives you access to the Python interpreter itself: its version, platform, arguments, output streams and more.
Used in 13 lessons of the course, from 00.01.
sys ships with Python, so you install nothing. You bring it in with import sys and reach its parts with a dot: sys.version, sys.platform.
Most of them are values that describe the interpreter running your code. For example, sys.version_info gives you the version as a tuple you can compare, and sys.platform names the operating system.
It also has tools: sys.exit() ends the program, sys.stdout and sys.stderr are the output channels, and sys.path is the list of folders where Python looks for modules.
It is used as a module, not as loose functions, so everything about the interpreter lives under one name and doesn't clash with your variables.
The course uses it from lesson 00.01 with import sys, usually to check the Python version of the environment.
Reach for it when: you need to know something about the interpreter (version, operating system), write to stdout or stderr, or end the program with an exit code.
Examples
Common mistake
print(sys.version_info.major)
Why: You used `sys` without importing it. Python doesn't bring the module into your code on its own.
How to write it: Write import sys before using it.
Common mistake
import sys print(sys.version_info.mayor)
Why: The module or object has no such name; a typo causes it.
How to write it: Check the name in the docs: it is major.
