Ex 3
Ex 3
PALANIRAJ
Roll no: 24ITB46
Aim
The aim of this exercise is to write python script for the given program using conditionals
statements & iterative loops and execute the same in Python IDLE (through Script or Development
Mode).
Problems Given
1. Number Series
2. Number Patterns
3. Pyramid Patterns
Concepts Involved
Decision Making Statements:
● Decision making constructs begins with a Boolean expression, an expression that returns
either True or False.
● In Python programming, zero or null vales are assumed as false.
● Decision making structures are necessary to perform an action or a calculation only when a
certain condition is met.
● In Python we have the following types of decision making statements. They are:
o if statement
o if..else statements
o elif statements
o Nested if..elif..else statements
o Inline if
● Conditional if statement
Syntax:
if Boolean expression:
Statement 1
Statement 2
…
Statement n
● Alternative if…else statement
Syntax:
if test expression:
statements
else:
statements
● Chained Conditional if..elif…else statements
Syntax:
if test_expression:
statements
elif test_expression:
statements
…..
else:
NAME: C.PALANIRAJ
Roll no: 24ITB46
statements
● Nested if…elif…else statements
Syntax:
if test_expression:
if test_expressioon_a:
statements
elif test_expression_b:
statements
else:
statements
elif test_expression:
statements
else:
statements
● Inline if statements
Syntax:
do Task A if condition is true else do Task B
statement n
1. Number Series
Code:
Output 1:
Output 2:
NAME: C.PALANIRAJ
Roll no: 24ITB46
2. Number Patterns
Code:
Output 1:
Output 2:
NAME: C.PALANIRAJ
Roll no: 24ITB46
3. Pyramid Patterns
Code:
Output 1:
Output 2:
NAME: C.PALANIRAJ
Roll no: 24ITB46
Rubrics Marks
Document Presentation
Timely submission
Total
Result:
NAME: C.PALANIRAJ
Roll no: 24ITB46
Thus , the given problems were implemented by python programming using conditional and
iteration loops and the output was verified successfully.