Python Notes for Software Developer & Data
Analyst
1. Core Python Concepts
• Python is an interpreted, high-level programming language with easy syntax.
• Variables, Data Types, and Operators are the building blocks.
• Conditional Statements: if, elif, else control the flow of execution.
• Loops: for and while loops help iterate over sequences.
• Functions: defined using 'def'. Lambda for small anonymous functions.
• Modules & Packages: reusable code blocks and library management.
• File Handling: open(), read(), write() and context manager with 'with'.
• Exception Handling: try, except, else, finally blocks.
2. Data Structures
• Lists – ordered, mutable collections.
• Tuples – ordered, immutable collections.
• Sets – unordered, unique items.
• Dictionaries – key-value pairs.
• Comprehensions: list, dict, and set comprehensions for concise loops.
3. Object-Oriented Programming (OOP)
• Classes and Objects encapsulate data and behavior.
• Key concepts: Inheritance, Polymorphism, Encapsulation, Abstraction.
• Special methods like __init__(), __str__(), __len__().
• Example: class Car: def __init__(self, brand, model): self.brand = brand self.model = model def
show(self): print(f"{self.brand} {self.model}")
4. Data Handling for Analysis
• Use Pandas for data manipulation and analysis.
• NumPy for numerical computations and arrays.
• Matplotlib for data visualization.
• Common tasks: reading CSV, cleaning data, grouping, plotting charts.
• Example: import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('sales.csv')
print(df.describe()) df['Revenue'].plot(kind='bar') plt.show()
5. Interview-Level Programs
• Reverse a string: s[::-1]
• Find factorial using recursion.
• Check palindrome using slicing.
• Sum of digits of a number using while loop.
• Count vowels in a string using for loop.
• Pattern printing problems.
• Sorting and searching algorithms (Bubble sort, Binary search).
6. Bonus Topics
• SQLite Integration: import sqlite3, connect(), execute().
• Reading Excel: pd.read_excel('file.xlsx')
• JSON handling: import json, json.load(), json.dump().
• Common interview questions and practice exercises.
End of Notes