File: EXPERIMENT_1_Introduction_to_Python.ipynb
Experiment Title: Introduction to Python
Author: Ronit Mehta
PRN: 25070123094
To study the basic concepts of Python programming, including variables, data types, input/output operations, arithmetic operations, mathematical functions, and conditional statements.
Python is a high-level, interpreted, and dynamically typed programming language known for its simplicity and readability.
Key concepts covered in this experiment:
- Variable declaration and assignment
- Printing output using
print() - Data types and type checking using
type() - Arithmetic operations
- User input using
input() - Mathematical operations using the
mathmodule - Conditional statements using
if–else
Python is widely used in data science, web development, automation, and artificial intelligence due to its rich libraries and ease of use.
- Display student name and PRN using markdown.
- Display the title: Introduction to Python.
Algorithm
- Assign multiple values to multiple variables in a single statement.
- Print all variables together.
- Print a single variable.
Output orange apple banana orange
Algorithm
- Assign integer, float, string, and boolean values to variables.
- Use
type()to display the data type of each variable.
Output <class 'int'> <class 'float'> <class 'str'>
Algorithm
- Assign values to two variables.
- Perform addition, subtraction, and multiplication.
- Display results using
print().
Output add = 15 subt = 5 mult = 50
Algorithm
- Accept two integer values from the user.
- Add the values.
- Display the result.
Output (example) Enter Value of X: 5 Enter Value of Y: 6 sum = 11
Algorithm
- Accept radius as user input.
- Calculate area using formula:
area = 3.14 × r² - Display the area.
Output (example) Enter Radius: 7 153.86
Algorithm
- Import the
mathmodule. - Accept radius as input.
- Use:
math.log10()math.pi
- Perform and display calculations.
Output (example) Enter Radius: 10 2.302585092994046 31.41592653589793
Algorithm
- Import the
mathmodule. - Calculate natural logarithm using
math.log(). - Calculate base-10 logarithm using
math.log10().
Output 0.9162907318741551 2.0
Algorithm
- Assign values to two variables.
- Compare values using an
if–elsecondition. - Display appropriate output based on condition.
Output b is greater than a
This experiment introduced the fundamental concepts of Python programming, including:
- Variable declaration and data types
- Input and output handling
- Arithmetic and mathematical operations
- Use of built-in and library functions
- Conditional logic using
if–else
Understanding these basics forms a strong foundation for advanced Python programming and real-world application dev