Python Sort List of Strings by Length

πŸ’‘ Problem Formulation: When working with lists of strings in Python, you may encounter a scenario where you need to sort the list not by alphabetical order, but by the length of the strings. For instance, given a list [“apple”, “fig”, “banana”], you’d want to reorganize the list to [“fig”, “apple”, “banana”], arranging the words … Read more

5 Best Ways to Sort List of Strings Containing Numbers (Python)

πŸ’‘ Problem Formulation: Working with datasets often involves sorting lists, and it can become tricky when a list contains strings with numbers. For instance, you might have a list like [“item2”, “item12”, “item1”] and want it sorted so that the numerical part of the strings dictates the order, resulting in [“item1”, “item2”, “item12”]. How can … Read more

Reverse Engineering Bill Gates’ $227 Million Mansion Using Midjourney

In this fun article, we’ll have a look at some beautiful mansion pics from Bill Gates’ House. We use the Midjourney /describe prompting technique to create image prompts based on the actual house owned by Bill Gates (source). Here’s the result for the first prompt: The result of the second prompt: The third prompt: The … Read more

Converting Binary to Decimal in Python: A Comprehensive Guide

Binary and decimal number systems are the backbone of computer technology and human-centric numeric representations. This guide provides you with various methods to convert a binary number, which is a series of 0s and 1s, into its decimal counterpart, an integer as we commonly use it. πŸ’‘ Problem Formulation: Converting numbers from binary format to … Read more

Python List of Strings to Bytes (5 Easy Ways)

πŸ’‘ Problem Formulation: In many programming scenarios with Python, you might need to convert a list of strings to a corresponding list of byte objects. For instance, if you have an input list [‘hello’, ‘world’], you might want the output to be [b’hello’, b’world’], where each string in the list is converted to its bytes … Read more

Python Create Set From 1 to N

πŸ’‘ Problem Formulation: In Python, we often need to create a set of integers starting at 1 and ending at a specified number n. This task is common for initializing data structures in algorithms, simulations, and more. For instance, if n=5, the desired output should be a set {1, 2, 3, 4, 5}. Method 1: … Read more

Following The Script

πŸ‘‰ This email is written on 02/07/2024 as part of the free Finxter newsletter. Join >100k tech enthusiasts! Here’s The Scriptβ„’ society wants you to follow: Work hard, be disciplined, study (and study some more) – and reach success. Well, society has no money-back guarantee (unlike Finxter). More importantly, you won’t get the lost time … Read more