Python_Developer.Full_course
Python_Developer.Full_course
2. Data Types
Common built-in types:
• int – Integer (5, -2)
• float – Decimal number (3.14, -0.5)
• str – String ("Hello", 'World')
• bool – Boolean (True, False)
age = 25 # int
pi = 3.14 # float
name = "Charlie" # str
is_active = True # bool
3. Conditional Statements
Use if, elif, and else for decision making.
age = 18
if age >= 18:
print("Adult")
elif age > 12:
print("Teen")
else:
print("Child")
4. Loops
• for loop: iterate over sequences
• while loop: repeat while a condition is true
# for loop
for i in range(5):
print(i)
# while loop
count = 0
while count < 5:
print(count)
count += 1
greet("Alice")
With return value:
def add(a, b):
return a + b
result = add(5, 3)
Simple Calculator
a = float(input("Enter first number: "))
op = input("Enter operation (+, -, *, /): ")
b = float(input("Enter second number: "))
if op == '+':
print("Result:", a + b)
elif op == '-':
print("Result:", a - b)
elif op == '*':
print("Result:", a * b)
elif op == '/':
print("Result:", a / b)
else:
print("Invalid operator")
if guess == number:
print("Correct! ")
else:
print(f"Wrong! The number was {number}")
Here's a clear explanation of the Core Concepts (Week 3–4) in Python, building on the
basics and introducing intermediate-level tools and techniques:
def greet(self):
print(f"Hello, I'm {self.name}")
p1 = Person("Alice")
p1.greet()
Inheritance
class Student(Person):
def study(self):
print(f"{self.name} is studying.")
s1 = Student("Bob")
s1.greet()
s1.study()
def __str__(self):
return f"{self.name}: {self.phone}"
def save_contact(contact):
with open("contacts.txt", "a") as file:
file.write(f"{contact.name},{contact.phone}\n")
def load_contacts():
contacts = []
try:
with open("contacts.txt", "r") as file:
for line in file:
name, phone = line.strip().split(",")
contacts.append(Contact(name, phone))
except FileNotFoundError:
pass
return contacts
# Example usage
c1 = Contact("Alice", "12345")
save_contact(c1)
for c in load_contacts():
print(c)
This stage helps solidify your understanding of data structures, OOP, and file interaction,
which are essential for any real-world application.
Here’s a breakdown of the Intermediate Python (Week 5–6) topics — essential for
writing more concise, modular, and powerful Python code.
1. List Comprehensions
A concise way to create lists.
# Traditional way
squares = []
for i in range(5):
squares.append(i * i)
# List comprehension
squares = [i * i for i in range(5)]
Supports conditions:
evens = [x for x in range(10) if x % 2 == 0]
Modules
Any .py file you can import.
# math_utils.py
def add(a, b):
return a + b
# main.py
import math_utils
print(math_utils.add(2, 3))
Packages
Folders with __init__.py, can contain multiple modules.
Virtual Environment
Keeps dependencies isolated per project.
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
@app.route("/")
def home():
return "Hello, Flask!"
if __name__ == "__main__":
app.run(debug=True)
Django
• Full-stack framework (ORM, admin panel, auth, etc.)
• Better for large, structured applications
django-admin startproject mysite
cd mysite
python manage.py runserver
2. Routing & Templates
Flask Routing
@app.route("/about")
def about():
return render_template("about.html")
Django Routing (URLconf)
# urls.py
urlpatterns = [
path("about/", views.about),
]
Templates (Flask & Django use Jinja-like syntax)
<!-- HTML template -->
<h1>Hello, {{ name }}</h1>
# views.py
def create_task(request):
if request.method == "POST":
Task.objects.create(title=request.POST['title'])
class Hello(Resource):
def get(self):
return {"message": "Hello World"}
api.add_resource(Hello, "/api")
Django REST Framework:
# views.py
from rest_framework.views import APIView
class HelloView(APIView):
def get(self, request):
return Response({"message": "Hello World"})
5. User Authentication
Django
Comes with built-in user model and auth views:
python manage.py createsuperuser
from django.contrib.auth import authenticate, login
Flask
Requires setup using Flask-Login:
from flask_login import LoginManager
You implement login routes, session handling, and password checks manually or with
extensions.
6. Project Ideas
Tips:
• Start with Flask if you're new.
• Choose Django for production-scale apps with built-in tools.
• Use tools like Postman to test APIs.
• Style using Bootstrap or Tailwind CSS.
Project Structure:
todo-flask/
├── app.py
├── templates/
│ ├── index.html
└── static/
└── style.css
app.py
from flask import Flask, render_template, request, redirect
app = Flask(__name__)
tasks = []
if __name__ == "__main__":
app.run(debug=True)
templates/index.html
<!DOCTYPE html>
<html>
<head>
<title>To-Do List</title>
</head>
<body>
<h1>My To-Do List</h1>
<form method="post">
<input name="task" required>
<button type="submit">Add</button>
</form>
<ul>
{% for task in tasks %}
<li>{{ task }}</li>
{% endfor %}
</ul>
</body>
</html>
Commands:
django-admin startproject blog_project
cd blog_project
python manage.py startapp blog
blog/models.py
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
created = models.DateTimeField(auto_now_add=True)
blog/views.py
from django.shortcuts import render
from .models import Post
def home(request):
posts = Post.objects.all()
return render(request, 'blog/home.html', {'posts': posts})
blog/templates/blog/home.html
<h1>My Blog</h1>
{% for post in posts %}
<h2>{{ post.title }}</h2>
<p>{{ post.content }}</p>
<hr>
{% endfor %}
Add to urls.py
from django.urls import path
from blog import views
urlpatterns = [
path('', views.home),
]
response = requests.get("https://example.com")
print(response.text)
driver = webdriver.Chrome()
driver.get("https://example.com")
print(driver.title)
driver.quit()
Use Selenium when JavaScript is required to load content.
2. Automate Browser Actions
With selenium, you can fill forms, click buttons, and extract content:
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://google.com")
def job():
print("Running scheduled task...")
schedule.every(5).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
cron (Linux/macOS) or Task Scheduler (Windows):
• Run scripts at specific times.
• Example cron job:
0 8 * * * /usr/bin/python3 /path/to/script.py
4. Excel or CSV Report Automation (Using pandas)
df = pd.read_csv("data.csv")
df["Total"] = df["Price"] * df["Quantity"]
df.to_csv("report.csv", index=False)
Excel Support:
df.to_excel("report.xlsx", index=False)
url = "https://news.ycombinator.com/"
html = requests.get(url).text
soup = BeautifulSoup(html, "html.parser")
msg = MIMEText(report)
msg["Subject"] = "Daily Hacker News Digest"
msg["From"] = "[email protected]"
msg["To"] = "[email protected]"
with smtplib.SMTP("smtp.gmail.com", 587) as server:
server.starttls()
server.login("[email protected]", "your_password")
server.send_message(msg)
Bonus Tools:
• pyautogui: Automate mouse/keyboard (GUI automation)
• openpyxl: Advanced Excel editing
• tabulate: Pretty-print tables in console
• apscheduler: More powerful task scheduler
Basic Commands:
CREATE TABLE products (
id INTEGER PRIMARY KEY,
name TEXT,
price REAL
);
SQLite
• Lightweight, built-in
• Great for small/local apps
PostgreSQL
• Powerful open-source RDBMS
• Great for production environments
We’ll use SQLite for quick examples.
conn = sqlite3.connect("inventory.db")
cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY, name
TEXT, qty INTEGER)")
cursor.execute("INSERT INTO items (name, qty) VALUES (?, ?)", ("Pen", 100))
conn.commit()
conn.close()
Fetch Data:
cursor.execute("SELECT * FROM items")
rows = cursor.fetchall()
for row in rows:
print(row)
class Item(Base):
__tablename__ = 'items'
id = Column(Integer, primary_key=True)
name = Column(String)
qty = Column(Integer)
engine = create_engine("sqlite:///inventory.db")
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
Django ORM
In models.py:
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=100)
qty = models.IntegerField()
Use:
python manage.py makemigrations
python manage.py migrate
Then query:
Product.objects.create(name="Chair", qty=20)
app = Flask(__name__)
Summary
Topic Tool/Concept
Using requests:
import requests
res = requests.get("https://api.github.com/users/octocat")
data = res.json()
print(data["name"], data["public_repos"])
response = httpx.get("https://api.github.com/users/octocat")
print(response.json())
asyncio Example:
import asyncio
asyncio.run(say_hello())
aiohttp for async HTTP calls:
import aiohttp
import asyncio
asyncio.run(fetch_data())
unittest Example:
import unittest
class TestMath(unittest.TestCase):
def test_add(self):
self.assertEqual(add(2, 3), 5)
unittest.main()
pytest Example:
def test_add():
assert add(2, 3) == 5
Run tests with: pytest test_file.py
4. Docker Basics
Docker helps you package your app + environment into containers — great for consistent
deployment.
Sample Dockerfile:
FROM python:3.11
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]
Project Idea:
• Flask API for products (GET, POST)
• React or simple HTML frontend to interact
• Dockerize both backend & frontend
Structure:
project/
├── backend/ (Flask)
│ ├── app.py
│ └── Dockerfile
├── frontend/ (HTML or React)
│ └── index.html
│ └── Dockerfile
├── docker-compose.yml
@app.route("/items", methods=["GET"])
def get_items():
return jsonify(data)
@app.route("/items", methods=["POST"])
def add_item():
item = request.json
data.append(item)
return jsonify(item), 201
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
docker-compose.yml
version: "3"
services:
backend:
build: ./backend
ports:
- "5000:5000"
frontend:
build: ./frontend
ports:
- "3000:3000"
Summary
Topic Tool/Concept
Here's a brief overview of Week 18+ Specialization paths — choose based on your
interests or career goals:
1. Data Science
• Tools: numpy, pandas, matplotlib, seaborn, scikit-learn
• Skills: Data wrangling, visualization, and basic ML models
• Example Project: Sales dashboard, COVID trend analysis, or customer
segmentation
2. Machine Learning
• Tools: TensorFlow, PyTorch, scikit-learn
• Skills: Neural networks, model training, evaluation, and deployment
• Example Project: Handwritten digit recognizer (MNIST), sentiment analysis, or
chatbot with NLP
3. Web Development (Advanced)
• Tools: Django REST Framework, JWT Auth, Celery, Redis
• Skills: RESTful APIs, user authentication, background tasks, and secure endpoints
• Example Project: E-commerce API, blog CMS backend, or task manager with user
login
4. Automation / DevOps
• Tools: Shell scripting, fabric, paramiko, GitHub Actions, Docker, Jenkins
• Skills: Server automation, cron jobs, deployment scripts, CI/CD pipelines
• Example Project: Auto-backup tool, deployment bot, or full pipeline with GitHub +
Docker
Here's a concise and practical guide to building your Portfolio & Preparing for Jobs as a
Python Developer:
1. GitHub Portfolio
• Upload all your projects (e.g., scraper, Flask app, ML models).
• Use clear README files: include project overview, features, tech used, how to run.
• Organize into folders and pin top repositories on your GitHub profile.
Pro Tip: Show progression — beginner to advanced projects.
3. Resume + LinkedIn
• Keep it 1 page, with:
o Skills (Python, Flask, SQL, etc.)
o Projects (with GitHub links)
o Education/Certifications
o Work/Internships (if any)
• LinkedIn:
o Add project posts, GitHub link, and a clean headline (e.g., "Python
Developer | ML Enthusiast").
Pro Tip: Use keywords from job descriptions for better searchability.
5. Mock Interviews
• Use platforms like Pramp, Interviewing.io, or peer practice.
• Prepare:
o Intro pitch ("Tell me about yourself")
o Explaining projects clearly
o Whiteboard or screen-share DSA problems
Task
Absolutely! Here's a detailed suggestion for both a sample portfolio website structure
and a resume template tailored for:
1. Python Developer
2. Data Analyst
Suggested Sections:
1. Home Page
• Short intro (“Hi, I’m Alex, a Python Developer/Data Analyst…”)
• Highlight main skills and link to resume
2. About Me
• Brief bio
• Education
• Interests in tech or data
3. Projects
For each project:
• Title + Short description
• Tools used (e.g., Python, Pandas, SQL)
• GitHub link
• Screenshots or demo video
4. Resume
• Button to download PDF
• Optional embedded resume view
5. Contact
• Email
• LinkedIn
• (Optional) Contact form
Python Developer
• Web scraper (BeautifulSoup + requests)
• Flask/Django web app
• API project
• Automation script (e.g., email report sender)
• Inventory/CRUD app with DB
Data Analyst
• EDA notebook (CSV or Excel dataset)
• Data visualization dashboard (Plotly, Seaborn)
• SQL + Pandas project
• Machine learning prediction (e.g., house price)
• Interactive dashboard (Streamlit or Tableau Public link)
Summary:
Python Developer with hands-on experience building web applications, APIs, and
automation tools. Proficient in Flask, SQL, and scripting.
Skills:
Python, Flask, SQL, HTML/CSS, Git, REST APIs, Selenium, Docker
Projects:
To-Do List Web App – Flask app with user auth, SQLite, and CRUD
Web Scraper – Automates data collection from job sites using BeautifulSoup
JSON Data Parser – Script that processes and structures raw JSON files
Experience:
Intern – Software Dev, XYZ Corp (3 months)
- Built internal tools for CSV-to-JSON conversion
- Automated reports via email using Python
Education:
B.Sc. in Computer Science – University Name
Skills:
Python, Pandas, NumPy, Matplotlib, Seaborn, Excel, SQL, Power BI, Tableau
Projects:
Sales Data Dashboard – Visualized regional sales trends using pandas + matplotlib
Certifications:
Google Data Analytics | SQL for Data Science (Coursera)
Education:
B.A. in Statistics – University Name