Horus University – Egypt
Faculty of Engineering
2023-2024
Artificial Intelligence
(ECE 481)
lab 2
Eng/ Sarah Fahmy
1
PYTHON OPERATORS
• Operators are used to perform operations on
variables and values.
• The main types of operators in python are:
1-Arithmetic operators
2-Assignment operators
3-Comparison operators
2
ARITHMETIC
OPERATORS
3
ARITHMETIC OPERATORS
• Arithmetic operators are used with numeric values.
4
ARITHMETIC OPERATORS
5
ASSIGNMENT
OPERATORS
6
ASSIGNMENT OPERATORS
• Assignment operators are used to assign values to
variable.
7
ASSIGNMENT OPERATORS
is same as:
8
COMPARISON
OPERATORS
9
COMPARISON OPERATORS
• Comparison operators are used to compare two
values.
10
COMPARISON OPERATORS
11
USER INPUT
12
USER INPUT
• Python allows for user input.
• That means we are able to ask the user for input.
• The method is a bit different in Python 3.6 than Python
2.7
• In python 3.6 we use the input() method, but in python
2.7 we use raw_input() method.
13
THANK YOU
14