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

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