## How to Delete an Object From a List in Python? 5 Ways

A Python list is a collection of objects that are indexed, ordered, and mutable. There are several different ways to delete a list item. We’ll first look at how we can delete single items from a list. And then finish with removing multiple objects. Method 1 – remove() Python list.remove() is a built-in list method … Read more

## How to Make Division by Zero to Zero in Python?

In Python, division by zero generates the exception ZeroDivisionError:  division by zero.  This is because in mathematics, division by zero is undefined. Today we’ll go over some ways to avoid the zero division error in Python and force it to return a zero. First, we’ll look into exception handling in Python. Second, we’ll examine different … Read more

## Ethereum – Top 10 Articles to Get Started

Can you believe 5 years ago 1 ETH was priced at \$9.33 USD?  ETH is now on the rise, priced at \$4270.66 USD with growth showing 45,673.42%.  But wait, are you still not sure what Ethereum is?  Perhaps you’ve heard of it but only have a vague idea.  Not to worry.  I’ve compiled a list … Read more

## How to Generate a Random Hex String in Python?

Today I will go over four methods to generate a random hex string in Python.  Firstly, from Python’s secrets module, we will use the function token_hex(n), where n specifies the number of bytes.  The resulting hex string will be of length n * 2.  Next, we will look at another function within the secrets module … Read more

## Python Count Characters Except Empty Spaces

In Python, a string includes not only the alphanumeric characters and symbols, but also all whitespaces.  Consider this simple example: We have a variable called mystring, and it is assigned to 3 characters a, b, and c.  Note we have separated each character with a space, so when calling the len() function we get the … Read more

## How to Generate a Random String in Python?

Problem Formulation You are tasked with writing Python code to generate a random string.  The string should contain any of the printable characters on your keyboard.  Letters, numbers, and punctuation marks are valid, and we’ll leave out any whitespace characters. What’s the best way to solve this in Python? Method 1: List Comprehension and random.randint() … Read more

## How to Call a Function from Another File in Python?

Introduction If you’re new to Python and have stumbled upon this question, then I invite you to read on as I discuss how to call a function from another file.  You have most likely used some of Python’s built-in functions already like print() and len().  But what if you’ve defined your own function, saved it … Read more

## How to Remove Empty Strings from a List of Strings?

When mentally approaching this problem, you may be tempted to utilize a “for loop”.  I admit that’s how my mind was working:  iterate through the list one element at a time and check for empty strings.  If it’s empty, remove it.  Repeat.  Please join me in today’s topic on how to remove empty strings from … Read more