NumPy Array Slicing – A Helpful Guide

Python NumPy array slicing is used to extract parts of data from an array. Array Slicing is often used when working with NumPy. In this article, we will go over the methods of array slicing, from basic to more advanced techniques. We will use the np.array() function to create our array examples. Before practicing any … Read more

How to Return a JSON Object From a Function in Python?

Return a JSON String Object from the json.dumps() Method The JSON (JavaScript Object Notation) format is widely used for transmitting structured data, especially between web applications. Fortunately, Python has several libraries for dealing with this data format, including the json module. The JSON format can nest data within โ€œobject literalsโ€ denoted by curly braces. Like … Read more

Python | Split String and Remove Last Element

๐ŸŽSummary: Split the string using rsplit with the specified separator and maxsplit as 1. This ensures the string is split from the right, and then you can extract the first value from this list which is the required output string. Minimal Example Problem Formulation ๐Ÿ“œProblem: How will you split a string and eliminate the last … Read more

Python | Split String and Remove newline

Summary: The simplest way to split a string and remove the newline characters is to use a list comprehension with a if condition that eliminates the newline strings. Minimal Example Problem Formulation Problem: Say you use the split function to split a string on all occurrences of a certain pattern. If the pattern appears at the … Read more

Python | Split String and Keep Head and Tail

Summary: You can use the split() method to extract the head and tail elements from a given string. Minimal Example In the following articles, we have learned how to split a string and keep the first and last elements separately. In this article, you will learn how to get the first element and the last … Read more

Python | Split String until Character/Substring

Summary: You can use one of the following methods to split a string until a given character – Minimal Example Problem Formulation  ๐Ÿ“œProblem: Given a string. How will you split the string until a given character or substring? The output must only contain the substring until the given delimiter. Letโ€™s visualize the problem with the … Read more

Solidity Assignments for Arrays and Structs

In this article, we’ll continue on the topic of the assignments, which we started in the previous article while talking about tuples. This article’s topic will focus on possible challenges when dealing with arrays and structs and the right approaches to resolve them. It’s part of our long-standing tradition to make this (and other) articles … Read more

Breaking Down Solidity Expression Trees and Tuple Assignments

In this article, we’ll start familiarizing ourselves with the order of evaluating expressions in Solidity. Plus, you’ll learn about multiple assignments (tuple assignments). Let’s go! ๐Ÿ’ช It’s part of our long-standing tradition to make this (and other) articles a faithful companion or a supplement to the official Solidity documentation. Order of Evaluation of Expressions Some … Read more

Spice Up Your Solidity with Salted Contract Creations & create2

Salted contract creation uses cryptographic “salt” to add an additional layer of security to a smart contract. Salt is a random string added to the contract code to make it harder for an attacker to reverse engineer the code and gain access to the contract. This makes the contract more secure and helps protect the … Read more

Smart Contracts – Discover How To Create Them Directly and Indirectly!

In this article, we’ll take a closer look at how contracts are created, both directly, i.e. while being implicitly deployed on the blockchain, and indirectly, i.e. when their creation is triggered by another contract. It’s part of our long-standing tradition to make this (and other) articles a faithful companion, or a supplement to the official … Read more