LLM in a Flash – Apple’s Attempt to Inject Intelligence Into the Edge

A new Apple research paper is taking the world by storm: LLM in a flash. ⚑ The ideas is simple: Making large language models (LLMs) work better on computers that don’t have a lot of memory. πŸ‘‰ If you’re a human reader, chances are you’re reading this on such a computer or smartphone. If you’re … Read more

Swap Function in Python: 5 Most Pythonic Ways to Swap

Several methods are available to implement a swap function in Python, including tuple assignment and XOR. Tuple Assignment Swap Method The tuple assignment method creates two tuples with two variables each. The first tuple contains the original variables, while the second one has their exchanged values. Finally, these tuples are “unpacked” into individual variables, effectively … Read more

Transformer vs LSTM: A Helpful Illustrated Guide

In the realm of natural language processing and machine learning, two common and highly effective models for handling sequential data are Transformers and Long Short-Term Memory (LSTM) networks. While both models have proven successful in various applications, they differ in terms of architectural structure and how they process and handle data. LSTM networks, a type … Read more

Python Int to String with Leading Zeros

To convert an integer i to a string with leading zeros so that it consists of 5 characters, use the format string f'{i:05d}’. The d flag in this expression defines that the result is a decimal value. The str(i).zfill(5) accomplishes the same string conversion of an integer with leading zeros. Challenge: Given an integer number. … Read more

How To Extract Numbers From A String In Python?

The easiest way to extract numbers from a Python string s is to use the expression re.findall(‘\d+’, s). For example, re.findall(‘\d+’, ‘hi 100 alice 18 old 42’) yields the list of strings [‘100′, ’18’, ’42’] that you can then convert to numbers using int() or float(). There are some tricks and alternatives, so keep reading … Read more

I Created a Crypto Arbitrage Trading Bot With Python

πŸ›‘ Disclaimer: NOT INVESTMENT ADVICE! In this short project, I’ll explain a Python trading bot I used for the purpose of arbitrage trading. I use Bitcoin BTC, but the arbitrage bot works better on illiquid and inefficiently priced coins — Bitcoin is usually far too liquid and efficiently priced for this to work. I also … Read more

Python Matplotlib Makes Conway’s Game of Life Come Alive

In this article, you’ll learn how to make this beautiful and interesting animation using only Python, NumPy, and Matplotlib — nothing else: πŸ‘‡ But how does the Game of Life work – and what’s behind the classical visualization anyways? The Game of Life Conway’s Game of Life is a cellular automaton devised by the British … Read more

Python – How to Find the Longest Substring in Alphabetical Order?

Programming Challenge πŸ’¬ Challenge: Given a Python string. Find the longest substring for which holds that all of its characters are in alphabetical order so that the first character comes earlier in the alphabet than the second character, and so on. Here are three examples: You get the point. πŸ™‚ Next, I’ll show you three … Read more

How to Find All Palindromes in a Python String?

Coding Challenge πŸ’¬ Challenge: Given a string. How to find all palindromes in the string? For comprehensibility, allow me to quickly add a definition of the term palindrome: πŸ’‘ Definition: A palindrome is a sequence of characters that reads the same backward as forward such as ‘madam’, ‘anna’, or ‘101’. This article wants to give … Read more