Pankaj Kumar

I have been working on Python programming for more than 12 years. At AskPython, I share my learning on Python with other fellow developers.

Python increment by 1

To increment a variable by 1 in Python, you can use the augmented assignment operator +=. This operator adds the right operand to the left operand and assigns the result to the left operand. For example, if you have a variable x with the value 5, you can increment it by 1 using the following …

Python increment by 1 Read More »

“and” in Python Logical Operator

Python has three logical operators. The logical operator “and” in Python is used with two boolean operands and returns a boolean value. It’s also called a short circuit operator or boolean operator. We can’t overload “and” operator in Python. It only works with boolean operands. Logical Operator – and in Python Let’s say we have …

“and” in Python Logical Operator Read More »

Python str() Function

Python str() function is one of the built-in functions. This function returns the string representation of the object. If there is no argument provided, it returns an empty string. Python str() Function Examples Let’s look at some simple examples of the str() function. How to implement str() function for an Object When we call the …

Python str() Function Read More »