How to Get the Command History in Python?

If you’re working with the command line in Windows or the terminal in Linux and macOS, you know about the feature of the command-line history. You can access all previously issued commands with the arrow up or arrow down keys. As a Python coder, you want to be able to control everything from your Python … Read more

How to Import Libraries in Python’s exec() Function?

What is the exec() Function exec() is a built-in Python function that is most commonly used to dynamically execute code,  either as a string or object code. To properly understand how we can use exec() to import libraries and modules we need to familiarize ourselves with the syntax of the function itself, as it becomes relevant later: … Read more

Symbolic Math with SymPy

This article shows how to solve math equations and expressions symbolically, in Python. Thanks to the Sympy library, this turns out to be an extremely easy task. However, as you will see in the following examples, the number of tools and functions provided by this library is huge. Thanks to all its features, Sympy represents … Read more

EZGmail and Python — Managing Your Emails Programmatically

Hey Finxters! Among the many daily tasks you can achieve with Python, there is one Siri-like task that comes quite handy: managing your emails in a programmatic way.  Of course, many emails need your human understanding to be processed properly, and this article is not about implementing a neural network to fine-tune every single email … Read more

What is an Array in Computer Science?

In computer science, an array data structure consists of a collection of elements—usually of the same type such as integer or string. Each element is identified by an array index. Arrays are designed to allow extremely efficient access of individual elements by index: runtime complexity is constant with growing array size! The reason is that … Read more

How to Split a String Between Numbers and Letters?

Problem Formulation: Given a string of letters and numbers. How to split the string into substrings of either letters or numbers by using the boundary between a letter and a number and vice versa. Examples: Have a look at the following examples of what you want to accomplish. ‘111A222B333C’ —> [‘111’, ‘A’, ‘222’, ‘B’, ‘333’, … Read more

NumPy Average

NumPy is a popular Python library for data science focusing on arrays, vectors, and matrices. It’s at the core of data science and machine learning in Python. In today’s article, you’ll going to master NumPy’s impressive average() function that will be a loyal friend to you when fighting your upcoming data science battles. average(a, axis=None, … Read more

NumPy Matrix Multiplication — np.matmul() and @ [Ultimate Guide]

NumPy’s np.matmul() and the @ operator perform matrix multiplication. They compute the dot product of two arrays. For 2D arrays, it’s equivalent to matrix multiplication, while for higher dimensions, it’s a sum product over the last axis of the first array and the second-to-last of the second array. Have you ever tried to multiply two … Read more