0% found this document useful (0 votes)
5 views8 pages

Python Assignment1

The document outlines the aim of learning control statements in Python, detailing various types such as if, if-else, elif, and nested if statements. It includes programming exercises to calculate factorials, check Armstrong numbers, display prime numbers, and create different patterns. The conclusion emphasizes the understanding of control statements through practical examples.

Uploaded by

Kabir Peswani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

Python Assignment1

The document outlines the aim of learning control statements in Python, detailing various types such as if, if-else, elif, and nested if statements. It includes programming exercises to calculate factorials, check Armstrong numbers, display prime numbers, and create different patterns. The conclusion emphasizes the understanding of control statements through practical examples.

Uploaded by

Kabir Peswani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

THADOMAL SHAHANI ENGINEERING

COLLEGE

DEPARTMENT OF INFORMATION
TECHNOLOGY

[Link] making and control statements


Aim: Learning Control Statements in Python.
Theory:
• if Statement
The if statement is used to execute a block of code if a
specified condition is True.
• If-Else Statement
The else statement follows an if block and runs when the
condition in the if statement is False.
• Elif (Else If) Statement
elif allows you to check multiple conditions. It’s used
when you want to check more than one condition, and if
the first one fails, it checks the next one.
• Nested If Statements
You can also place an if statement inside another if
statement to check multiple conditions.

Program with output:


• WAP to calculate Factorial of a number given by user.

• WAP to display whether a number is Armstrong or not.


• Write a program to display prime numbers within a
range given by the user.
• WAP a program to display different patterns (Upper
and lower triangle, diamond, X).
UPPER AND LOWER TRIANGLE:
DIAMOND PATTERN

X PATTERN
• WAP a program to display table of a number given by user.
Conclusion:
We can observe the working of control statements in Python.

You might also like