
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

704 Views
The modulo operator is denoted by the "%" symbol in Python. It can also be called the remainder operator because it is used to return the remainder of the division of two numeric operands. Using this operator, we can solve problems ranging from simple to complex. Syntax of Python Modulo Operator The modulo operator in Python works the same as the remainder of dividing the two numeric operands. Following is the syntax of the modulo operator - Result = a % b Where a and b are the operands, % represents the modulo operator, and ... Read More

8K+ 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. Tilde Operation on Decimal Numbers When we perform a tilde operation on decimal numbers, the following steps are involved: Convert the decimal number to binary, including the sign. If the number is positive, place 0 in ... Read More

37K+ Views
In this tutorial, we will learn how to subtract days from a date in JavaScript. To subtract days from a JavaScript Date object, use the setDate() method. Under that, get the current days and subtract days. JavaScript date setDate() method sets the day of the month for a specified date according to local time. Following are the methods we can use to subtract days from a date in JavaScript − Using the setTime() and getTime() methods Using the setDate() and getDate() methods ... Read More

135 Views
Understanding the Operator in Python The is one of the operators available in Python. The present version that we are using is Python 3. The previous version was Python 2. Some of the operators in Python 2 don't support in Python 3. is used in Python 2, which is not supported in Python. The operator != is used in Python 3. The functionality of the or != is to represent not equal to. The output of these operators is in the format of Boolean values True or False. Syntax The following is the syntax for using ... Read More

302 Views
In C/C++, Java, etc., ++ and -- operators are defined as increment and decrement operators. In Python, they are not defined as operators. Increment and Decrement Operators in Python In Python, objects are stored in memory. Variables are just labels. Numeric objects are immutable. Hence, they can't be incremented or decremented. However, prefix ++ or -- doesn't give an error but doesn't perform either. As Prefix In the following example, when have used prefix increment which does not raise an error - x=5 print(++x) print(--x) Following is the output of the above code - 5 5 As Postfix In ... Read More

625 Views
The % symbol in Python is defined as the modulo operator. It can also called as remainder operator. It returns the remainder of the division of two numeric operands (except complex numbers). The Python modulo % operator is a part of arithmetic operations like addition (+), subtraction (-), multiplication (*), division (/), exponential (**), and floor division (//). The following is the basic syntax for the % modulo operator - x % y Modulo Operation on Integers When we perform a modulo operation on two integers, the result is the remainder of the division, ... Read More

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

430 Views
It is a bitwise right shift operator. The bit pattern is shifted towards right by number of places stipulated by operand on right. Bits on left are set to 0For example a=60 (00111100 in binary), a>>2 will result in 15 (00001111 in binary)>>> a=60 >>> bin(a)result #39;0b111100' >>> b=a>>2 >>> bin(b) '0b1111'

5K+ Views
In Python, 'not in' membership operator evaluates to true if it does not finds a variable in the specified sequence and false otherwise. For example >>> a = 10 >>> b = 4 >>> l1 = [1,2,3,4,5] >>> a not in l1 True >>> b not in l1 False Since 'a' doesn't belong to l1, a not in b returns True. However, b can be found in l1, hence b not in l1 returns False

311 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 - if condition: ... Read More