AGENDA


Decision Making

Loops
Python Decision Making



Decision making structures require that the programmer specify one or more conditions
Types of decision making
 statements
IF

IF...ELSE statements

Nested IF statements

statements
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 requirement


 While loop
 For loop
While Loop

Example:



count = 0

while (count < 9):

print 'The count is:', count

count = count + 1


print "Good bye!"


Loop Control Statements:



Loop control statements change execution from its normal sequence. When execution le

break statement

continue statement

pass statement

Break Statement:



Example
 for letter in 'Python':

if letter == 'h':

break

print 'Current Letter :', letter




Break Statement
continue statement



The continue statement in Python returns the control to the beginning of the while loop. T

for letter in 'Python':
 if letter == 'h':
 continue
 print 'Current Letter :', letter


continue statement


pass statement



The pass statement in Python is used when a statement is required syntactically but you do

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

Python session3