Programming Articles

Page 636 of 2547

What does these operators mean (** , ^ , %, //) ?

Disha Verma
Disha Verma
Updated on 24-Mar-2026 726 Views

In Python, there are various types of operators used to perform specific functions, such as (**), (^), (%), and (//). The (**) operator represents exponentiation, (^) represents bitwise XOR, (%) represents the modulus operation, and (//) represents floor division. In this article, we will understand the workings of these operators. Exponentiation Operator (**) The exponentiation operator (**) is used to raise a number to a power. This operator works the same as the Python pow() method. In exponentiation, you need two numbers: the first is the base (the number you want to raise), and the second is the ...

Read More

What is the difference between = and == operators in Python?

Disha Verma
Disha Verma
Updated on 24-Mar-2026 2K+ Views

The symbols "=" and "==" look similar but have different meanings and usability in Python. The "=" symbol is the assignment operator, and the "==" symbol represents a comparison operator. In this article, we will understand the difference between these two and how to use them. The "=" Operator The "=" operator in Python is the assignment operator. It is used to assign a value to a variable. You put the variable on the left side and the value or expression on the right side. The value on the right is stored in the variable on the left. ...

Read More

What is different in OR and AND operators in Python?

Disha Verma
Disha Verma
Updated on 24-Mar-2026 7K+ Views

The OR and AND operators are the most commonly used logical operators in Python. These operators are used to perform decision-making operations by combining multiple conditions. In this article, we will understand what OR and AND operators are in Python and how they differ, along with examples for better understanding. AND Operator in Python The logical AND operator in Python needs two operands. It returns True if both operands are true, and it returns False if either of the operands is false. This operator is mostly used in situations where you want to make sure that two conditions ...

Read More

What is modulo % operator in Python?

Disha Verma
Disha Verma
Updated on 24-Mar-2026 1K+ Views

The modulo operator is denoted by the "%" symbol in Python. It returns the remainder of the division between two numeric operands, making it useful for solving problems ranging from simple arithmetic to complex mathematical operations. Syntax The modulo operator works by returning the remainder after dividing two numbers ? result = a % b Where a and b are the operands, % represents the modulo operator, and result stores the remainder of dividing a by b. Modulo Operator with Integers Using the modulo operator with integers is the most common use ...

Read More

What is tilde (~) operator in Python?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 10K+ Views

In Python, the bitwise operator ~ (pronounced as tilde) is a complement operator. It takes one bit operand and returns its complement. If the operand is 1, it returns 0, and if it is 0, it returns 1. For example, consider the 4-bit binary number (1100)2. By performing the tilde operation, each bit is flipped and results in (0011)2. Syntax result = ~operand Tilde Operation on Decimal Numbers When we perform a tilde operation on decimal numbers, the following steps are involved − Convert the decimal number ...

Read More

What is operation of <> in Python?

Niharika Aitam
Niharika Aitam
Updated on 24-Mar-2026 214 Views

The operator was a comparison operator in Python 2 used to check if two values are not equal. This operator has been removed in Python 3 and replaced with != for the same functionality. Syntax Python 2 (Deprecated) variable1 variable2 Python 3 (Current) variable1 != variable2 Both operators return True if the values are not equal, and False if they are equal. Python 2 Example (Historical) In Python 2, the operator worked as follows ? # Python 2 only a = 10 b = 20 ...

Read More

What is behavior of ++ and -- operators in Python?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 405 Views

In C/C++, Java, and other languages, ++ and -- operators are defined as increment and decrement operators. However, Python does not have these operators built into the language. Why Python Doesn't Support ++ and -- Operators In Python, objects are stored in memory and variables are just labels pointing to these objects. Numeric objects like integers and floats are immutable, meaning they cannot be modified in place. This design makes traditional increment and decrement operators unnecessary. Prefix ++ and -- Behavior When you use prefix ++ or -- operators in Python, they don't raise an error ...

Read More

What is function of ^ operator in Python

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 1K+ Views

In Python, the XOR operator is one of the bitwise operators and is represented by the caret symbol ^. It returns 0 if both operands are the same and 1 if the operands are different. Truth Table of XOR The following is the truth table of the XOR (exclusive OR) operator − A B ...

Read More

Does Python have a ternary conditional operator?

Akshitha Mote
Akshitha Mote
Updated on 24-Mar-2026 434 Views

The Python ternary operator returns a value based on whether a condition is True or False. It is similar to an if-else statement but is expressed in a single line. For understanding the ternary operator, we need to have an idea about conditional statements. Let's have a basic understanding of the if-else statement. We will have an if block followed by an else block here. The if block is executed when the given condition is True, and the else block is executed if the given condition is False. The following is the basic syntax of the if-else statement ...

Read More

How to declare a multi dimensional dictionary in Python?

Niharika Aitam
Niharika Aitam
Updated on 24-Mar-2026 1K+ Views

Multidimensional dictionaries in Python are nested dictionary structures where values can themselves be dictionaries. They are created by assigning a dictionary to a key within another dictionary, represented by curly braces {} and can accommodate any data type. These structures consist of unique key-value pairs separated by a colon (:). While keys must be unique, values can be duplicated. Since dictionaries don't support indexing, you access values using their keys. Syntax The basic syntax for creating multidimensional dictionaries in Python is ? variable_name = {k1: {d1}, k2: {d2}} Where: ...

Read More
Showing 6351–6360 of 25,466 articles
« Prev 1 634 635 636 637 638 2547 Next »
Advertisements