XIO

xWire

Posts from every feed QUEST has found across the web — blogs, news, podcasts, channels and more.

AskPython

Python Tutorials for Beginners and Experienced Programmers

Fortnite Ranked Reload Explained: Best Strategies to Climb Faster

Fortnite Ranked Reload may seem familiar to experienced players, but climbing its ranked ladder requires a different approach from standard Battle Royale. The game has faster action, smaller matches, and eliminated players can return while their teammates are still alive. Ranked Reload rewards a combination of eliminations and placement, so simply hiding until the end […]

Text Mining Python: Analyze Documents

To analyze documents in Python, convert their text into structured features software can inspect. Text mining creates features such as token counts and TF-IDF weights, with TF-IDF giving less weight to terms found in many documents. I’ll show how to set up a small corpus and represent its documents with counts or TF-IDF. TL;DR Text […]

How to Use Index in Python

Working with Python data often means reading a known position or finding where a value appears. Indexing uses square brackets to read by position, and index() searches for a matching value. This article shows how those operations differ and how to use enumerate() when a loop needs both an item and its position. TL;DR: Use […]

Create Mastermind Game in Python: A Terminal Tutorial

Creating a game in Python can start with a terminal version of Mastermind. Python chooses a hidden four-letter color code and gives a clue after each valid guess, showing exact matches and colors in the wrong positions. This article shows how to build and run the game, including how its clues score repeated colors. TL;DR […]

EOL While Scanning String Literal in Python

Finding the quote or source line where a Python string should end is the first step in fixing this SyntaxError. “EOL while scanning string literal” means Python reached a line ending before it found the end of a quoted string. This article explains what the message means and shows how to trace the reported line […]

SVD NumPy: Decompose a Matrix

To decompose a matrix in NumPy, use SVD. SVD expresses the matrix as a product of factors. I’ll explain the shapes of those factors and show how to reconstruct the matrix or make a lower-rank approximation. TL;DR: NumPy SVD returns U, s, and Vh Call np.linalg.svd(A, full_matrices=False) for a compact decomposition, then reconstruct a 2D […]

Python Print to File: Save Script Output

To save Python print() output in a file, send it to an open text file instead of the terminal. The file argument lets print() write its text to that file. This article shows how to write print() output to a UTF-8 text file and choose whether to replace or add to its contents. TL;DR: Write […]

Python argparse: Parse Command-Line Arguments

Giving a Python program clear command-line inputs starts with defining what callers can supply. argparse lets you define those inputs and read their parsed values in your program. I’ll show how to define command-line inputs with argparse and explain its Python 3.14 feedback options. TL;DR Use argparse.ArgumentParser to define command-line inputs, then call parse_args() to […]

Python Sets: Fix the Indexing TypeError

Retrieving or testing a set member is the goal when Python reports TypeError: ‘set’ object is not subscriptable. A Python set stores distinct values and supports membership checks, but it does not support positional lookup. I’ll explain what the error means and show how to choose an operation that matches the result you need. TL;DR: […]

Building Bingo with Python

Want to build your own bingo game? Python is a good way to get started. You can put together a basic version without getting bogged down in complicated code, then add features once the thing actually works. There’s a bit more to it than picking random numbers. You need to generate cards, keep track of […]

Queue in Python: Create and Use Queues

As you build a Python program that processes items in sequence, a queue holds them until they are retrieved. Python’s queue module includes synchronized FIFO queues, while collections.deque provides a basic FIFO container. I’ll explain how to create a queue and pair retrieved work with completion tracking. You’ll also learn when priority ordering is useful. […]

Python Exception Handling: How to Fix Ignored Messages

When Python prints “Exception ignored in,” check the traceback to find the code that raised the exception. Python uses this message when an exception cannot be returned to an ordinary caller, often during cleanup. I’ll explain what the message means and show how to repair the code the traceback points to. TL;DR: Fix the code […]

How to Handle Files in Python

Working with files in Python starts with deciding whether your program needs to read data or write it. File handling lets Python read from a named file or write data to it, and open() returns the file object used to do that. I’ll explain how to choose a file mode and use a context manager […]

How to Import Other Python Files

When you want one Python file to use a function or class from another, you can import its definitions instead of copying them. A Python module is a file whose names can be made available to other code with an import statement. I’ll explain what a module is and show how to import code from […]

Pandas Melt and Pivot Data

A table can keep one row per record while storing each measurement in a separate column. Pandas melt turns selected measurement columns into labeled rows, and pivot reshapes those rows into columns again. This article walks through choosing columns for melt and restoring a wide table with pivot. TL;DR: Melt wide data into long rows […]

Python pytz: Migrate to zoneinfo

Updating timezone code in a Python app means checking that its dates still mean what you intend. pytz is a separately installed package for working with time zones, while zoneinfo is Python’s built-in option in Python 3.9 and later. This article shows how to map pytz calls to zoneinfo and compare their behavior at daylight-saving […]

How to Pass a Function as an Argument in Python

A Python function sometimes needs to let another function choose how to handle a value. Passing the function by name gives the receiving function a callable it can invoke when needed. I’ll explain when to pass a function rather than call it, then show how to pass one with arguments already set. TL;DR Pass the […]

What Does the @ Symbol Do in Python?

When you write or review a Python function, an @ line above def can be hard to interpret at first. In Python, @ applies a decorator to the function being defined, while between operands it requests matrix multiplication. I’ll show how Python applies decorators, then explain how operand types determine whether matrix multiplication works. TL;DR: […]

Python zip() Function: Pair Iterables

Related values often arrive in separate lists, such as names in one list and scores in another. Python’s zip() function pairs items at matching positions and returns an iterator that yields tuples. I’ll explain what zip() returns and show how to pair iterables, including how it handles different lengths. TL;DR: What the Python zip() Function […]

Python Variables: How to Create and Use Them

Giving a Python value a name lets you use it again. A variable is a name in a namespace that refers to an object. I’ll show how to assign a value to a name and inspect it with print() and type(). TL;DR: Python Variables A Python variable is a name bound to an object, and […]

staticmethod Python: How to Use Static Methods

Seeing @staticmethod in Python code can raise a basic question: why doesn’t the method have a self parameter, which refers to the current instance? The decorator marks a method that receives no instance or class argument automatically when called. I’ll show how to define and call a static method, then explain when it fits better […]

Python Import Statement: How to Use It

A script that uses Python’s math module needs a way to refer to its code. An import statement makes a module or selected names available to your script. I’ll show how to choose an import form and check which locations Python searches for a module. TL;DR Python import statements make modules or selected names available […]

Python Write File: Choose the Right Mode

A file that already contains notes can be a place to add another line without losing what’s there. Python’s append mode writes new text at the end, while other modes can create or replace a file. I’ll explain how the modes differ and show how to append text without replacing what’s already there. TL;DR: Write […]

Current Date and Time in Python: Get and Format It

A date shown in a report needs a format readers can interpret, while calculations need the underlying date or time value. Python’s datetime module provides objects for representing those values. I’ll show how to get today’s date or the current time and format it for display, including a value in an explicit time zone. TL;DR: […]

How to Use Python Property Decorator

A class may need to show a value that changes with its other data, and callers may still read it with dot notation. Python’s property decorator lets a class expose a method as an attribute that can compute a value when read. I’ll show how to define a computed property and add a setter to […]

Convert a Tuple to a String in Python

A tuple can hold values that need to appear as text in a log or output field. Python’s join() method combines string values with a separator, while str() turns a tuple into its Python-style representation, including punctuation. I’ll show how to choose a string format and join tuple values, including values that need conversion first. […]

HashSet Hashtable Python: Choose the Right Types

An inventory often needs a quick way to find the quantity attached to a product name. Python dicts map keys to values, while sets hold distinct values for membership checks. I’ll explain how to choose between them and demonstrate dictionary lookups and set operations. TL;DR: Python Sets and Dictionaries In Python, use a set for […]

How to Sort a Python List

When a list’s values are out of order, sorting puts them in the order Python compares them. Python’s list.sort() changes the list itself, while sorted() returns a new sorted list and leaves the source unchanged. I’ll show how to sort values in either direction and when to use sorted() to preserve the source list. TL;DR […]