Python Programming Assignment
Introduction to Python
• Python is a high-level, interpreted, and general-purpose programming language.
It is easy to learn and widely used for web development, AI, data science, automation, and desktop appli
• Python was created by Guido van Rossum and released in 1991.
Arrays in Python
• An array stores multiple values of the same type in a single variable.
• Python commonly uses lists as arrays.
Example: numbers = [1, 2, 3, 4, 5]
Array Functions
• append() → Adds an element at the end of the array.
• insert() → Inserts an element at a specific position.
• remove() → Removes a specific element.
• pop() → Removes the last element.
• sort() → Sorts the array elements.
• reverse() → Reverses the array.
Functions in Python
• A function is a block of code used to perform a specific task.
• Functions help in code reusability and organization.
Example:
def add(a, b):
return a + b
Loops in Python
• Loops are used to repeat instructions multiple times.
There are two main types of loops in Python: for loop and while loop.
Example of for loop:
for i in range(5):
print(i)
Class Work / OOP
• Python supports Object-Oriented Programming (OOP).
A class is a blueprint for creating objects.
Example:
class Student:
def __init__(self, name):
[Link] = name
Conclusion
• Python is a powerful and beginner-friendly programming language.
• Arrays, functions, loops, and classes are important concepts used in software development.