SlideShare a Scribd company logo
1 of 10
Operators In Python
‫إعداد‬:‫م‬.‫محمد‬ ‫علي‬
Operators
• Attribution: (=) example x=5 in this case we give x the value 5
• Summation: (+) example x=5 y=6 z=x+y in this case z equal to 11
• Subtraction: (-) example x=5 y=6 z=y-x in this case z equal to 1
• Multiplication: (*) example x=5 y=6 z=x*7 in this case z equal to 31
• Division: (/) example x=5 y=25 z=y/x in this case z equal to 5.0
• Mod: (%) example x=5 y=25 z=y%x in this case z equal to 0
Operators Result
• In all programming languages if we division int/int like 5/5 the result will be
of type int (1)
• In python it’s deference a little.
• Rule: any division result in python it gave the type (float)
• So in python when we put (5/5) the result will be 1.0 in float data type.
Math operator
• The operator (x+=5)  x=x+5
• The operator (x-=5)  x=x-5
• The operator (x*=5)  x=x*5
• The operator (x/=5)  x=x/5
Logical operators
• Grater than (<)
• Less than (>)
• Equal (==)
• Grate than or equal (<=)
• Less than or equal (>=)
• No equal (!=)
Logical Operators
• In python we can us the keywords (in, not in).
• To get a logical result: like the following example:
x=5
x not in range (1,5)
• Result is true because 5 in range [1 2 3 4 5]
• So the range function give me a series of number
Logical Operators
• In python we can us the keywords (in, not in).
• To get a logical result: like the following example:
x=5
x in range (1,5)
• Result is false because 5 in range [1 2 3 4 5]
Range syantax
• range(stop)
• range (start,stop)
• range (start,stop,step)
Logical Operators
• We can use the keywords (and – or) to get a logical operators
• Example: 5<10 and 5>3
result will be (True)
• Example: 5<10 or 5<3
result will be (True)
Summary

More Related Content

What's hot

Python iteration
Python iterationPython iteration
Python iteration
dietbuddha
 

What's hot (18)

Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in python
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Python basics
Python basicsPython basics
Python basics
 
Python iteration
Python iterationPython iteration
Python iteration
 
Static type checking in python
Static type checking in pythonStatic type checking in python
Static type checking in python
 
Types of Statements in Python Programming Language
Types of Statements in Python Programming LanguageTypes of Statements in Python Programming Language
Types of Statements in Python Programming Language
 
Tugas algoritma fibonacci
Tugas algoritma   fibonacciTugas algoritma   fibonacci
Tugas algoritma fibonacci
 
Python unit 2 as per Anna university syllabus
Python unit 2 as per Anna university syllabusPython unit 2 as per Anna university syllabus
Python unit 2 as per Anna university syllabus
 
Type Casting Operator
Type Casting OperatorType Casting Operator
Type Casting Operator
 
Python for Beginners(v2)
Python for Beginners(v2)Python for Beginners(v2)
Python for Beginners(v2)
 
Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02
 
C preprocesor
C preprocesorC preprocesor
C preprocesor
 
Cse115 lecture04introtoc programming
Cse115 lecture04introtoc programmingCse115 lecture04introtoc programming
Cse115 lecture04introtoc programming
 
MATLAB programming tips 2 - Input and Output Commands
MATLAB programming tips 2 - Input and Output CommandsMATLAB programming tips 2 - Input and Output Commands
MATLAB programming tips 2 - Input and Output Commands
 
C++ Ch3
C++ Ch3C++ Ch3
C++ Ch3
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
Variables and Data Types
Variables and Data TypesVariables and Data Types
Variables and Data Types
 
Cse115 lecture03problemsolving
Cse115 lecture03problemsolvingCse115 lecture03problemsolving
Cse115 lecture03problemsolving
 

Similar to Second session from learn python tutorial

C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
jahanullah
 
ESCM303 Introduction to Python Programming.pptx
ESCM303 Introduction to Python Programming.pptxESCM303 Introduction to Python Programming.pptx
ESCM303 Introduction to Python Programming.pptx
AvijitChaudhuri3
 

Similar to Second session from learn python tutorial (20)

Operators in python
Operators in pythonOperators in python
Operators in python
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 
Operators_in_Python_Simplified_languages
Operators_in_Python_Simplified_languagesOperators_in_Python_Simplified_languages
Operators_in_Python_Simplified_languages
 
Operators
OperatorsOperators
Operators
 
Go programming introduction
Go programming introductionGo programming introduction
Go programming introduction
 
Php
PhpPhp
Php
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
Chaptfffffuuer05.PPT
Chaptfffffuuer05.PPTChaptfffffuuer05.PPT
Chaptfffffuuer05.PPT
 
Functional Operations - Susan Potter
Functional Operations - Susan PotterFunctional Operations - Susan Potter
Functional Operations - Susan Potter
 
Python Basics by Akanksha Bali
Python Basics by Akanksha BaliPython Basics by Akanksha Bali
Python Basics by Akanksha Bali
 
Java introduction
Java introductionJava introduction
Java introduction
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Python Operators
Python OperatorsPython Operators
Python Operators
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
 
Python - Lecture 2
Python - Lecture 2Python - Lecture 2
Python - Lecture 2
 
Python programming
Python programmingPython programming
Python programming
 
Basics of Python Programming
Basics of Python ProgrammingBasics of Python Programming
Basics of Python Programming
 
ESCM303 Introduction to Python Programming.pptx
ESCM303 Introduction to Python Programming.pptxESCM303 Introduction to Python Programming.pptx
ESCM303 Introduction to Python Programming.pptx
 
Lecture 05.pptx
Lecture 05.pptxLecture 05.pptx
Lecture 05.pptx
 

More from AliMohammad155

More from AliMohammad155 (20)

#1 الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
#1  الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...#1  الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
#1 الدرس الأول من دروس مسار تعلم ال SQL Server بعنوان مخطط ال ERD والتكامل ا...
 
شرح مبسط وبسيط لمفهوم ال VLAN
شرح مبسط وبسيط لمفهوم ال VLANشرح مبسط وبسيط لمفهوم ال VLAN
شرح مبسط وبسيط لمفهوم ال VLAN
 
11th session classes diagrams
11th session classes diagrams11th session classes diagrams
11th session classes diagrams
 
10th session erd
10th session erd10th session erd
10th session erd
 
Static route and rip and ospf
Static route and rip and ospfStatic route and rip and ospf
Static route and rip and ospf
 
Ninth session software engineering sequence diagram
Ninth session software engineering sequence diagramNinth session software engineering sequence diagram
Ninth session software engineering sequence diagram
 
Routers and packet tracer
Routers and packet tracerRouters and packet tracer
Routers and packet tracer
 
Viii session activity diagram
Viii session activity diagramViii session activity diagram
Viii session activity diagram
 
OSI Model
OSI ModelOSI Model
OSI Model
 
Seventh session functional and non functional requrements &amp; usecase example
Seventh session functional and non functional requrements &amp; usecase exampleSeventh session functional and non functional requrements &amp; usecase example
Seventh session functional and non functional requrements &amp; usecase example
 
Vlsm and flsm example
Vlsm and flsm exampleVlsm and flsm example
Vlsm and flsm example
 
Sixth session software engineering usecase diagrams
Sixth session software engineering usecase diagramsSixth session software engineering usecase diagrams
Sixth session software engineering usecase diagrams
 
fifth session in networking subnetmask and subnetting
fifth session in networking subnetmask and subnettingfifth session in networking subnetmask and subnetting
fifth session in networking subnetmask and subnetting
 
functional requirements and non functional requirements
functional requirements and non functional requirementsfunctional requirements and non functional requirements
functional requirements and non functional requirements
 
fourth session of basics in networks
fourth session of basics in networksfourth session of basics in networks
fourth session of basics in networks
 
Fourth session software engineering
Fourth session software engineeringFourth session software engineering
Fourth session software engineering
 
third session of basics in networks
third session of basics in networksthird session of basics in networks
third session of basics in networks
 
Third session software engineering
Third session software engineeringThird session software engineering
Third session software engineering
 
Second session Networking (Network topology)
Second session Networking (Network topology)Second session Networking (Network topology)
Second session Networking (Network topology)
 
Second session software engineering algorithms
Second session software engineering   algorithmsSecond session software engineering   algorithms
Second session software engineering algorithms
 

Recently uploaded

Recently uploaded (20)

Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 

Second session from learn python tutorial

  • 2. Operators • Attribution: (=) example x=5 in this case we give x the value 5 • Summation: (+) example x=5 y=6 z=x+y in this case z equal to 11 • Subtraction: (-) example x=5 y=6 z=y-x in this case z equal to 1 • Multiplication: (*) example x=5 y=6 z=x*7 in this case z equal to 31 • Division: (/) example x=5 y=25 z=y/x in this case z equal to 5.0 • Mod: (%) example x=5 y=25 z=y%x in this case z equal to 0
  • 3. Operators Result • In all programming languages if we division int/int like 5/5 the result will be of type int (1) • In python it’s deference a little. • Rule: any division result in python it gave the type (float) • So in python when we put (5/5) the result will be 1.0 in float data type.
  • 4. Math operator • The operator (x+=5)  x=x+5 • The operator (x-=5)  x=x-5 • The operator (x*=5)  x=x*5 • The operator (x/=5)  x=x/5
  • 5. Logical operators • Grater than (<) • Less than (>) • Equal (==) • Grate than or equal (<=) • Less than or equal (>=) • No equal (!=)
  • 6. Logical Operators • In python we can us the keywords (in, not in). • To get a logical result: like the following example: x=5 x not in range (1,5) • Result is true because 5 in range [1 2 3 4 5] • So the range function give me a series of number
  • 7. Logical Operators • In python we can us the keywords (in, not in). • To get a logical result: like the following example: x=5 x in range (1,5) • Result is false because 5 in range [1 2 3 4 5]
  • 8. Range syantax • range(stop) • range (start,stop) • range (start,stop,step)
  • 9. Logical Operators • We can use the keywords (and – or) to get a logical operators • Example: 5<10 and 5>3 result will be (True) • Example: 5<10 or 5<3 result will be (True)