Python While Loop With Examples

While Loop in Python

While giving a weekend session for a Python user group in New York, I covered a topic on the Python while loop with examples. You should know about the while loop if you want to learn Python. In this tutorial, let me explain Python while looping with examples. What is a While Loop in Python? … Read more

How to Print Variable Name Instead of Value in Python?

Python print variable name instead of value

Today’s topic is tricky, and I will show you here how to print variable name instead of value in Python. There are different methods to do it. To print a variable name instead of its value in Python, you can use f-strings (available from Python 3.6 onwards). By prefixing the string with f and enclosing … Read more

How to Set a Variable to Infinity in Python?

Set a Variable to Infinity in Python

Recently, someone asked me how to set a variable to infinity in Python. Infinity is a concept that represents a value larger than any finite number. In this tutorial, I will explain different methods to set a variable to infinity in Python with a few real-world examples. To set a variable to infinity in Python, … Read more

How to Check if a Variable is an Integer in Python?

Check if a Variable is an Integer in Python

While doing some programming, I got a requirement to check if a variable is an integer in Python. I tried different methods. In this tutorial, I will show you different methods to determine whether a variable is an integer, along with practical examples. To check if a variable is an integer in Python, you can … Read more

How to Initialize an Empty Variable in Python?

python initialize empty variable

Recently, someone asked me about initializing empty variables in Python. I suggested a few methods. In this tutorial, I will show you how to initialize an empty variable in Python with examples. To initialize an empty variable in Python, you can assign it the value None. This indicates that the variable is currently empty and … Read more

Difference Between = and == in Python With Examples

difference between = and == in python with example

As a Python developer, you should know the difference between = and ==. In this tutorial, I will explain the difference between the assignment operator (=) and the equality operator (==) in Python with examples. The Assignment Operator (=) The assignment operator (=) in Python is used to assign a value to a variable. It … Read more

Difference Between Mutable And Immutable In Python With Examples

Mutable Vs Immutable In Python

This concept is very tricky, and you should know it as a Python developer. In this tutorial, I will explain the difference between mutable and immutable in Python with examples. What Are Mutable and Immutable Objects in Python? Now, let us first understand what are mutable and immutable objects in Python. Mutable Objects in Python … Read more