The equals() method of the String class accepts a String as a parameter and it compares the current string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this ... Read More
According to wiki “An anagram is word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.”To compare whether two strings are anagrams check if their lengths are equal? If so, convert these two strings into character arrays then, ... Read More
You can convert a String value to an integer either using the valueOf() method of the String class or using the toString() method of the Integer class.
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 >>> ... Read More
In Python, ^ is called EXOR operator. It is a bitwise operator which takes bits as operands. It returns 1 if one operand is 1 and other is 0.Assuming a=60 (00111100 in binary) and b=13 (00001101 in binary) bitwise XOR of a and b returns 49 (00110001 in binary)>>> a=60 ... Read More
In Python % is an arithmetic operator that returns remainder of division operation. It is called modulo or remainder operator and operates upon numeric operands except complex numbers>>> a=10 >>> a%3 1 >>> a%5 0 >>> b=12.5 >>> b%2.5 0.0 >>> b%2 0.5Read More
In C/C++ and Java etc, ++ and -- operators are defined as increment and decrement operators. In Python they are not defined as operators.In Python objects are stored in memory. Variables are just the labels. Numeric objects are immutable. Hence they can't be incremented or decremented.However, prefix ++ or -- ... Read More
The <> operator is available in Python 2.x as not equal to operator. there is also != operator for the same operation. In Python 3.x, <> operator is deprecated.Python 2.7>>> a=5 ... Read More
Each Python object is assigned a unique identification number when it is stored in memory. It can be fetched by id() function. The is operator compares id() of two objects and returns True if both objects have same value otherwise it returns false. The is not operator on the other ... Read More
Following table shows all assignment operators − Operator Description Example = Assigns values from right side operands to left side operand c = a + b value of a + b into c += It adds right operand to the left operand and ... Read More