Experiment 1: Print Function in Python
❖ Aim:
To understand and use the print() function in Python for
displaying output.
❖ Theory:
The print() function in Python is used to display output on the
screen. It can print strings, numbers, variables, and formatted
text. The function supports multiple arguments, escape
sequences, and formatted output.
➢ Examples:
Experiment 2: Taking input from User
❖ Aim:
To learn how to take user input in Python using the input()
function and display the result.
❖ Theory:
The input() function in Python is used to take user input from
the keyboard during program execution. By default, it captures
input as a string, but it can be converted to other data types
like integers and floats using type casting. This function is
useful for making interactive programs where users can
provide data dynamically.
➢ Examples:
Experiment 3:Conditional Statements and Loops
❖ Aim:
To understand and implement conditional statements (if-else) and
loops (for, while) in Python.
❖ Theory:
Conditional statements (if, elif, else) are used to make
decisions in a program based on given conditions. Loops (for,
while) allow repeated execution of a block of code based on
conditions or sequences.
The if-elif-else structure helps execute different code blocks
depending on conditions.
The for loop is used for iterating over sequences such as lists
or ranges.
The while loop continues execution as long as the condition
remains true.
Loop control statements like break and continue help modify loop
behaviour.
➢ Examples: if-else & elif
➢ Examples: Using Loops
➢ Examples: Using Break & Continue keyword