#!/usr/bin/env python3 """Quick system info formatter - displays hostname, OS, kernel, and CPU count.""" import platform import os import socket def get_system_info(): """Gather system information.""" return { 'hostname': socket.gethostname(), 'system': platform.system(), 'release': platform.release(), 'kernel': platform.version(), 'cpu_count': os.cpu_count() or 'N/A', 'python': platform.python_version(), } def format_system_info(): """Return formatted system info string.""" info = get_system_info() lines = [ "=== System Information ===", f"Hostname: {info['hostname']}", f"OS: {info['system']} {info['release']}", f"Kernel: {info['kernel']}", f"CPU Cores: {info['cpu_count']}", f"Python: {info['python']}", ] return '\n'.join(lines) if __name__ == '__main__': print(format_system_info())