Professional Documents
Culture Documents
Hersh.hama@uor.edu.krd
Basic Operators
Operators are special symbols that carry out arithmetic or logical computation.
The value that the operator operates on is called the operand.
Arithmetic Operators: Arithmetic operators are used to perform mathematical
operations like addition, subtraction, multiplication, etc.
Addition (+): Add two operands. (e.g. x + y)
Subtraction (-): Subtract right operand from the left. (e.g. x – y - 2)
Multiplication (*): Multiply two operands. (e.g. x * y)
Division (÷): Divide left operand by the right one. (e.g. x / y)
Modulus (%): remainder of the division of left operand by the right. (x % y)
Exponent (**): left operand raised to the power of right. (e.g. x**2) 2
1
5/3/2023
OUTPUT
2
5/3/2023
OUTPUT
Logical Operators
Logical operators are:
AND: True if both the operands are true.
OR: True if either of the operands is true.
NOT: True if operand is false (complements the operand) true.
3
5/3/2023
Input Function
To allow flexibility, we might want to take the input from the user. In Python, we
have the input() function to allow this.
Here, we can see that the entered value 20 is a string, not a number.
To convert this into a number we can use int() or float() functions.