ECP281
ENGINEERING COMPUTER PROGRAMMING
EBU-NKAMAODO O.T.
OSADOLOR A.O.
INTRODUCTION TO PROGRAMMING
WITH PYTHON
●
Those who don’t have laptops test their python codes at
[Link]
●
It does require the use of the internet
●
You can also download pydroid3
01/24/2023 3
OPERATORS
Assignment operator
Arithmetic operators
Relational operators
Logical operators
Increment and decrement operators
01/24/2023 4
Assignment operator
●
Assigns values to variables
●
e.g. x = 4
01/24/2023 5
Arithmetic operators
●
Used for mathematical operations
e.g.
●
9*8
●
5/2
01/24/2023 6
Relational operators
●
They compare two operands
e.g.
●
a = 12
●
b = 15
●
Print(a>b)
01/24/2023 7
Logical operators
There are three logical operators:
●
“and”,
●
“or” and
●
“not”.
01/24/2023 8
Increment and decrement operators
●
Increment operators add a number to a variable and save the
result in the same variable
x=x+1
x = +1
●
Decrement operators subtract a number from a variable and save
the result in the same variable
x=x-1
x = -1
01/24/2023 9