User Tools

Site Tools


products:ict:python:operators_questions

What are operators in Python? Answer: Operators are special symbols or characters that perform specific operations on one or more operands.

What is the difference between == and = in Python? Answer: == is a comparison operator that checks whether two values are equal, whereas = is an assignment operator that assigns a value to a variable.

What is the modulus operator (%) in Python used for? Answer: The modulus operator (%) returns the remainder of the division of two numbers.

What is the difference between / and in Python? Answer: / is a division operator that returns a floating-point number, whereas is an integer division operator that returns the quotient of the division as an integer.

What is the exponentiation operator () in Python used for? Answer: The exponentiation operator () raises the first operand to the power of the second operand.

What is the unary operator in Python? Answer: The unary operator is an operator that operates on a single operand, such as the negative (-) sign.

What is the ternary operator in Python? Answer: The ternary operator is a conditional operator that evaluates an expression based on a condition.

What is the bitwise AND operator (&) in Python used for? Answer: The bitwise AND operator (&) performs a bitwise AND operation on two numbers.

What is the bitwise OR operator (|) in Python used for? Answer: The bitwise OR operator (|) performs a bitwise OR operation on two numbers.

What is the bitwise XOR operator (^) in Python used for? Answer: The bitwise XOR operator (^) performs a bitwise XOR operation on two numbers.

What is the bitwise left shift operator («) in Python used for? Answer: The bitwise left shift operator («) shifts the bits of the first operand to the left by the number of bits specified in the second operand.

What is the bitwise right shift operator (») in Python used for? Answer: The bitwise right shift operator (») shifts the bits of the first operand to the right by the number of bits specified in the second operand.

What is the identity operator (is) in Python used for? Answer: The identity operator (is) checks whether two variables refer to the same object in memory.

What is the membership operator (in) in Python used for? Answer: The membership operator (in) checks whether a value is present in a sequence.

What is the not operator in Python used for? Answer: The not operator is a logical operator that negates the value of a boolean expression.

What is the and operator in Python used for? Answer: The and operator is a logical operator that returns True if both operands are True.

What is the or operator in Python used for? Answer: The or operator is a logical operator that returns True if at least one of the operands is True.

What is the augmented assignment operator in Python? Answer: The augmented assignment operator is a shorthand operator that combines an assignment operator with another operator, such as += or *=.

What is the comparison operator in Python used for? Answer: The comparison operator is an operator that compares two values and returns a boolean value (True or False) based on the comparison.

What is operator precedence in Python? Answer: Operator precedence determines the order in which operators are evaluated in a Python expression.

products/ict/python/operators_questions.txt · Last modified: 2023/05/06 15:49 by wikiadmin