SlideShare a Scribd company logo
1 of 15
AGENDA

Decision Making
Loops
Python Decision Making


Decision making structures require that the
programmer specify one or more conditions to be
evaluated or tested by the program, along with a
statement or statements to be executed if the condition is
determined to be true, and optionally, other statements to
be executed if the condition is determined to be false.
Types of decision making
statements
 IF statements
 IF...ELSE statements
 Nested IF statements
IF statements Flow Diagram:

Test Exp

FALSE

TRUE

Body of if

EXIT
IF...ELSE statements Flow Diagram:

Test Exp

FALSE

If Block

TRUE

Body of Else



EXIT
The else statement is an optional statement and there could be at most only one
else statement following if .
LOOPS




A loop statement allows us to execute a statement or
group of statements multiple times
Python programming language provides following types
of loops to handle looping requirements

 While loop
 For loop
While Loop
Example:
count = 0
while (count < 9):
print 'The count is:', count
count = count + 1
print "Good bye!"
For Loop
If a sequence contains an expression list, it is
evaluated first. Then, the first item in the sequence is
assigned to the iterating variable iterating_var. Next, the
statements block is executed. Each item in the list is
assigned to iterating_var, and the statement(s) block is
executed until the entire sequence is exhausted.
Example:
for letter in 'Python':
print 'Current Letter :', letter

String
Loop Control Statements:
Loop control statements change execution from its
normal sequence. When execution leaves a scope, all
automatic objects that were created in that scope are
destroyed.


break statement



continue statement



pass statement
Break Statement:

Example
for letter in 'Python':
if letter == 'h':
break

Break Statement

print 'Current Letter :', letter
continue statement
The continue statement in Python returns the control
to the beginning of the while loop. The continue
statement rejects all the remaining statements in the
current iteration of the loop and moves the control back
to the top of the loop.
for letter in 'Python':
if letter == 'h':
continue

continue statement

print 'Current Letter :', letter
pass statement
The pass statement in Python is used when a statement
is required syntactically but you do not want any
command or code to execute.
The pass statement is a null operation; nothing happens
when it executes.
for letter in 'Python':
if letter == 'h':
pass
print 'This is pass block'
print 'Current Letter :', letter
Reference


http://www.tutorialspoint.com/python/
Python session3

More Related Content

What's hot (20)

Comp ppt (1)
Comp ppt (1)Comp ppt (1)
Comp ppt (1)
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Python loops
Python loopsPython loops
Python loops
 
Chap 6(decision making-looping)
Chap 6(decision making-looping)Chap 6(decision making-looping)
Chap 6(decision making-looping)
 
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested LoopLoops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
 
Control structures
Control structuresControl structures
Control structures
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Kelompok 8 Pbw
Kelompok 8 PbwKelompok 8 Pbw
Kelompok 8 Pbw
 
Kelompok 8 Pbw
Kelompok 8 PbwKelompok 8 Pbw
Kelompok 8 Pbw
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
 
Looping
LoopingLooping
Looping
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Loops
LoopsLoops
Loops
 
While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While Loop
 
Control statements
Control statementsControl statements
Control statements
 
Flow of control ppt
Flow of control pptFlow of control ppt
Flow of control ppt
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Understand Decision structures in c++ (cplusplus)
Understand Decision structures in c++ (cplusplus)Understand Decision structures in c++ (cplusplus)
Understand Decision structures in c++ (cplusplus)
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Looping statements
Looping statementsLooping statements
Looping statements
 

Viewers also liked

Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01frans2014
 
μυστράς (2)
μυστράς (2)μυστράς (2)
μυστράς (2)Theod13
 
Tradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in AustraliaTradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in AustraliaTradieExchange
 
Virtualization session3 vm installation
Virtualization session3 vm installationVirtualization session3 vm installation
Virtualization session3 vm installationAswin Krishnamoorthy
 
Tradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in AustraliaTradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in AustraliaTradieExchange
 
Perencanaan sambungan-profil-baja
Perencanaan sambungan-profil-bajaPerencanaan sambungan-profil-baja
Perencanaan sambungan-profil-bajafrans2014
 
გარემოს დაცვის კლუბების მნიშვნელობა
გარემოს დაცვის კლუბების მნიშვნელობაგარემოს დაცვის კლუბების მნიშვნელობა
გარემოს დაცვის კლუბების მნიშვნელობაNato Khuroshvili
 
παρουσίαση προγράμματος
παρουσίαση προγράμματοςπαρουσίαση προγράμματος
παρουσίαση προγράμματοςTheod13
 
An RGB Laser And Its Applications
An RGB Laser And Its ApplicationsAn RGB Laser And Its Applications
An RGB Laser And Its Applicationsznsaja
 
2016 IoT Business Forum
2016 IoT Business Forum2016 IoT Business Forum
2016 IoT Business ForumMarlos Bosso
 
Μυστράς Α
Μυστράς ΑΜυστράς Α
Μυστράς ΑTheod13
 
Analisa ecotects
Analisa ecotectsAnalisa ecotects
Analisa ecotectsfrans2014
 
[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)
[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)
[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)інна гаврилець
 
Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02frans2014
 
Modulmekanikateknik1 121101215953-phpapp01
Modulmekanikateknik1 121101215953-phpapp01Modulmekanikateknik1 121101215953-phpapp01
Modulmekanikateknik1 121101215953-phpapp01frans2014
 

Viewers also liked (18)

Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01Tugassejaraharsitektur 131112083046-phpapp01
Tugassejaraharsitektur 131112083046-phpapp01
 
μυστράς (2)
μυστράς (2)μυστράς (2)
μυστράς (2)
 
Tradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in AustraliaTradie Exchange Jobs - Referrals in Australia
Tradie Exchange Jobs - Referrals in Australia
 
Virtualization session3 vm installation
Virtualization session3 vm installationVirtualization session3 vm installation
Virtualization session3 vm installation
 
Tradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in AustraliaTradie Exchange Jobs - Hiring in Australia
Tradie Exchange Jobs - Hiring in Australia
 
Perencanaan sambungan-profil-baja
Perencanaan sambungan-profil-bajaPerencanaan sambungan-profil-baja
Perencanaan sambungan-profil-baja
 
გარემოს დაცვის კლუბების მნიშვნელობა
გარემოს დაცვის კლუბების მნიშვნელობაგარემოს დაცვის კლუბების მნიშვნელობა
გარემოს დაცვის კლუბების მნიშვნელობა
 
παρουσίαση προγράμματος
παρουσίαση προγράμματοςπαρουσίαση προγράμματος
παρουσίαση προγράμματος
 
An RGB Laser And Its Applications
An RGB Laser And Its ApplicationsAn RGB Laser And Its Applications
An RGB Laser And Its Applications
 
δ.θ
δ.θδ.θ
δ.θ
 
2016 IoT Business Forum
2016 IoT Business Forum2016 IoT Business Forum
2016 IoT Business Forum
 
Μυστράς Α
Μυστράς ΑΜυστράς Α
Μυστράς Α
 
Analisa ecotects
Analisa ecotectsAnalisa ecotects
Analisa ecotects
 
[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)
[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)
[S hegda a.v.]_ekonomіka_pіdpriєmstva._zbіrnik_(book_fi.org)
 
Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02Ppipp copy-130823044640-phpapp02
Ppipp copy-130823044640-phpapp02
 
Html
HtmlHtml
Html
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
Modulmekanikateknik1 121101215953-phpapp01
Modulmekanikateknik1 121101215953-phpapp01Modulmekanikateknik1 121101215953-phpapp01
Modulmekanikateknik1 121101215953-phpapp01
 

Similar to Python session3

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 LanguageExplore Skilled
 
control statements in python.pptx
control statements in python.pptxcontrol statements in python.pptx
control statements in python.pptxAnshu Varma
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Syed Farjad Zia Zaidi
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSAniruddha Paul
 
ppt python notes list tuple data types ope
ppt python notes list tuple data types opeppt python notes list tuple data types ope
ppt python notes list tuple data types opeSukhpreetSingh519414
 
class interview demo
class interview demo class interview demo
class interview demo HELP4STUDENTS
 
Demo for Class.pptx
 Demo for Class.pptx Demo for Class.pptx
Demo for Class.pptxHELP4STUDENTS
 
PPT_203105211_3.pptx
PPT_203105211_3.pptxPPT_203105211_3.pptx
PPT_203105211_3.pptxSaurabhNage1
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONvikram mahendra
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1Devashish Kumar
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJTANUJ ⠀
 
6 Iterative Statements.pptx
6 Iterative Statements.pptx6 Iterative Statements.pptx
6 Iterative Statements.pptxssuser8e50d8
 
if else python.pdf
if else python.pdfif else python.pdf
if else python.pdfGshs6
 

Similar to Python session3 (20)

iterations.docx
iterations.docxiterations.docx
iterations.docx
 
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
 
control statements in python.pptx
control statements in python.pptxcontrol statements in python.pptx
control statements in python.pptx
 
Unit - 2 CAP.pptx
Unit - 2 CAP.pptxUnit - 2 CAP.pptx
Unit - 2 CAP.pptx
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
 
ppt python notes list tuple data types ope
ppt python notes list tuple data types opeppt python notes list tuple data types ope
ppt python notes list tuple data types ope
 
class interview demo
class interview demo class interview demo
class interview demo
 
python
pythonpython
python
 
Demo for Class.pptx
 Demo for Class.pptx Demo for Class.pptx
Demo for Class.pptx
 
PPT_203105211_3.pptx
PPT_203105211_3.pptxPPT_203105211_3.pptx
PPT_203105211_3.pptx
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJ
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
6 Iterative Statements.pptx
6 Iterative Statements.pptx6 Iterative Statements.pptx
6 Iterative Statements.pptx
 
if else python.pdf
if else python.pdfif else python.pdf
if else python.pdf
 
python.pptx
python.pptxpython.pptx
python.pptx
 
Loops
LoopsLoops
Loops
 
Ch-4.pdf
Ch-4.pdfCh-4.pdf
Ch-4.pdf
 

Recently uploaded

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Python session3

  • 1.
  • 3. Python Decision Making  Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.
  • 4. Types of decision making statements  IF statements  IF...ELSE statements  Nested IF statements
  • 5. IF statements Flow Diagram: Test Exp FALSE TRUE Body of if EXIT
  • 6. IF...ELSE statements Flow Diagram: Test Exp FALSE If Block TRUE Body of Else  EXIT The else statement is an optional statement and there could be at most only one else statement following if .
  • 7. LOOPS   A loop statement allows us to execute a statement or group of statements multiple times Python programming language provides following types of loops to handle looping requirements  While loop  For loop
  • 8. While Loop Example: count = 0 while (count < 9): print 'The count is:', count count = count + 1 print "Good bye!"
  • 9. For Loop If a sequence contains an expression list, it is evaluated first. Then, the first item in the sequence is assigned to the iterating variable iterating_var. Next, the statements block is executed. Each item in the list is assigned to iterating_var, and the statement(s) block is executed until the entire sequence is exhausted. Example: for letter in 'Python': print 'Current Letter :', letter String
  • 10. Loop Control Statements: Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed.  break statement  continue statement  pass statement
  • 11. Break Statement: Example for letter in 'Python': if letter == 'h': break Break Statement print 'Current Letter :', letter
  • 12. continue statement The continue statement in Python returns the control to the beginning of the while loop. The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop. for letter in 'Python': if letter == 'h': continue continue statement print 'Current Letter :', letter
  • 13. pass statement The pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute. The pass statement is a null operation; nothing happens when it executes. for letter in 'Python': if letter == 'h': pass print 'This is pass block' print 'Current Letter :', letter