Lec3 4
Lec3 4
PYTHON
Done By: Thana Abdulhalim
01
Python Numbers
Int Float Complex
Python Numbers
● Int: Int, or integer, is a whole number,
positive or negative, without
decimals, of unlimited length.
03
● Print “this is ‘my’ code”
03
Booleans & Operators
Booleans Operators
Booleans Values
● In programming you often need to know if
an expression is True or False
● You can evaluate any expression in
Python, and get one of two answers
● When you compare two values, the
expression is evaluated and Python
returns the Boolean answer
● The bool() function allows you to evaluate
any value, and give you True or False
Example
Example
Python Operators
Python divides the operators in the
following groups:
● Arithmetic operators
● Assignment operators
● Comparison operators
● Logical operators
Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
Floor Division (returns the quotient
//
without the remainder)
Modulo (returns the remainder of
%
division)
** Exponentiation
= Assignment
== Equality
!= Not equal
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
and Logical AND
or Logical OR
not Logical NOT
03
Practice Time !
Booleans Operators
5 Minutes
● Check the bool value of
01 “hello” , 33 , {}
● print these operation : x**x ,
y+z
write a program to
accept a string from
user then print the
letters that are in even
index .
Quiz Time
01 02
03 04
Q.01
What are the 3 numbers data
type
Q.02
How to convert type from float to
int
Q.03
What are the logical operators
Q.04
What was the input function in
python 2.7
Thanks!
Do you have any questions?