python

Python is a high-level, interpreted, general-purpose programming language. It is known for its clear and readable syntax, which emphasizes code readability and reduces the cost of program maintenance. Key characteristics of Python: Interpreted Python code is executed line by line by an interpreter, without the need for a separate compilation step. This speeds up the development process, as changes can be tested immediately. High-level Python abstracts away low-level details of computer hardware, allowing developers to focus on problem-solving rather than managing memory or system resources. ...

August 16, 2025 · 1 min · Kristian Alexander P

perfect-number

What is perfect number? In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3 (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number. The next perfect number is 28, since 1 + 2 + 4 + 7 + 14 = 28. ...

March 14, 2024 · 1 min · Kristian Alexander P

python script examples

Example python scripts archlinux packages import subprocess def packages_list(): """Yay packages list""" packages = subprocess.run(["yay", "-Qu"], capture_output=True, text=True) if packages.stdout: return packages.stdout else: return "all packages updated!" return packages_list() get the wireless interface import subprocess import re def get_wlan_iface(): """Get the wireless interface name.""" interfaces = subprocess.run( ["ip", "link", "show"], capture_output=True, text=True ) pattern = r"(^\d+:\s+)(wl.+):" for iface in interfaces.stdout.splitlines(): if re.search(pattern, iface): match = re.search(pattern, iface) assert match is not None return match.group(2) return get_wlan_iface()

March 14, 2024 · 1 min · Kristian Alexander P