0% found this document useful (0 votes)
2 views

Python_Programming_Notes

The document provides detailed notes on Python programming, covering prerequisites, basic concepts, control flow, functions, file handling, object-oriented programming, advanced concepts, and libraries. It includes examples for algorithms, data types, control statements, file operations, OOP principles, regular expressions, and the use of libraries like NumPy and Pandas. Each module builds on the previous one, offering a comprehensive overview of Python programming skills.

Uploaded by

meet.nandha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python_Programming_Notes

The document provides detailed notes on Python programming, covering prerequisites, basic concepts, control flow, functions, file handling, object-oriented programming, advanced concepts, and libraries. It includes examples for algorithms, data types, control statements, file operations, OOP principles, regular expressions, and the use of libraries like NumPy and Pandas. Each module builds on the previous one, offering a comprehensive overview of Python programming skills.

Uploaded by

meet.nandha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Programming - Detailed Notes

Module 0: Prerequisite

Introduction to Programming: Understanding algorithms, flowcharts, and pseudocode.


Example Algorithm:
1. Start
2. Take two numbers as input
3. Add the numbers
4. Display the sum
5. Stop

Module 1: Introduction to Python

Python is a high-level, interpreted programming language.


Data Types: int, float, str, list, tuple, set, dict
Example:
name = input("Enter your name: ")
print("Hello, " + name + "!")

Module 2: Control Flow and Functions

Control Statements: if, else, elif


Loops: for, while
Example Function:
def check_number(n):
if n % 2 == 0:
return "Even"
else:
return "Odd"
print(check_number(5))

Module 3: File Handling, Packaging, and Debugging


File Handling:
with open("sample.txt", "w") as file:
file.write("Hello, Python!")

Module 4: Object-Oriented Programming (OOP)

Concepts: Class, Object, Encapsulation, Inheritance, Polymorphism


Example:
class Animal:
def __init__(self, name):
self.name = name

def speak(self):
return "I am an animal"

class Dog(Animal):
def speak(self):
return "Bark!"

dog = Dog("Tommy")
print(dog.speak()) # Output: Bark!

Module 5: Advanced Python Concepts

Regular Expressions:
import re
pattern = r"\b\d{3}-\d{3}-\d{4}\b"
text = "Call me at 123-456-7890."
match = re.findall(pattern, text)
print(match) # Output: ['123-456-7890']

Module 6: Python Libraries

NumPy, Pandas, Matplotlib


Example:
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(arr.mean()) # Output: 3.0

You might also like