0% found this document useful (0 votes)
14 views8 pages

Customized Plan Python Web Dev

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views8 pages

Customized Plan Python Web Dev

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Material Assessment and Daily Activity Plan (20 Hours Total)

The material is divided into eight 2–3 hour sessions, ensuring comprehensive coverage of
essential topics from Stages 1, 2, and 3. Each session includes a mix of lectures, discussions,
and hands-on activities.

Day 1: Python Foundation Basics (2 Hours)


Objective: Introduce Python basics and data structures.
 Time Breakdown:
o 1 hour: Python Introduction (Python introduction, Installing Anaconda, Variables,
Constants, Datatypes) – Lecture (30 min), Hands-on (30 min).
o 1 hour: Control Structures and Loops – Lecture (30 min), Hands-on (30 min).
 Key Activities:
o Install Anaconda and write a simple Python script using variables and loops.
 Assessment: Quick quiz on data types and loops.

Task:
Write a Python program that:

Genz , millineal
 Asks the user for their name and age.
 Checks if the age is above 18.
 If yes, prints "Welcome, [name]! You are eligible."
 If not, prints "Sorry, [name]. You are not eligible."

Solution:
python
# Ask for user input
name = input("Enter your name: ")
age = int(input("Enter your age: "))

# Check if age is above 18


if age > 18:
print(f"Welcome, {name}! You are eligible.")
else:
print(f"Sorry, {name}. You are not eligible.")
Explanation:
This task introduces basic input/output, type conversion (int()), and conditional statements
(if-else), which are foundational skills for Python beginners.

Day 2: Python Data Structures (2 Hours)


Objective: Explore Python data structures.
 Time Breakdown:
o 1 hour: Lists, Tuples, and their operations – Lecture (30 min), Hands-on (30 min).
o 1 hour: Sets, Dictionaries, and their operations – Lecture (30 min), Hands-on (30
min).
 Key Activities:
o Practice creating and manipulating lists, tuples, sets, and dictionaries.
 Assessment: Mini-task: Write a program to manage a dictionary of student grades.

Task:
Create a dictionary to store student grades:
 Add at least three students with their grades.
 Write a function to calculate the average grade.
 Print the average grade.

Solution:
python
# Create a dictionary of student grades
grades = {"Alice": 85, "Bob": 90, "Charlie": 78}

# Function to calculate average grade


def average_grade(grades_dict):
total = sum(grades_dict.values())
count = len(grades_dict)
return total / count if count > 0 else 0

# Calculate and print average


avg = average_grade(grades)
print(f"The average grade is: {avg:.2f}")
Explanation:
This task uses a dictionary to store key-value pairs, introduces function definition, and applies
built-in methods like sum() and len(). The .2f format ensures the average is displayed with
two decimal places.

Day 3: Python Scope and OOPS Basics (3 Hours)


Objective: Cover Python scope and introduce OOPS concepts.
 Time Breakdown:
o 1 hour: Global, Local, and Non-local variables – Lecture (30 min), Hands-on (30
min).
o 1 hour: OOPS Concepts – Classes, Objects – Lecture (30 min), Hands-on (30
min).
o 1 hour: Inheritance – Lecture (30 min), Hands-on (30 min).
 Key Activities:
o Write a program demonstrating variable scopes and a class with inheritance.
 Assessment: Create a simple class hierarchy (e.g., Animal → Dog).

Task:
Create a BankAccount class:
 With attributes: account_number and balance.
 Methods: deposit(amount) and withdraw(amount).
 Handle exceptions for insufficient balance.
 Save account details to a file.

Solution:
python
class BankAccount:
def __init__(self, account_number, balance=0):
self.account_number = account_number
self.balance = balance

def deposit(self, amount):


self.balance += amount
return f"Deposited {amount}. New balance: {self.balance}"

def withdraw(self, amount):


if amount > self.balance:
raise ValueError("Insufficient balance")
self.balance -= amount
return f"Withdrew {amount}. New balance: {self.balance}"

def save_to_file(self):
with open(f"{self.account_number}.txt", "w") as file:
file.write(f"Account Number: {self.account_number}\nBalance:
{self.balance}")

# Example usage
try:
account = BankAccount("12345", 100)
print(account.deposit(50))
print(account.withdraw(30))
account.save_to_file()
except ValueError as e:
print(e)
Explanation:
This task introduces object-oriented programming (OOP) with classes, methods, and attributes. It
also covers exception handling (try-except) and file handling (open, write), creating a text
file with the account details.

Day 4: File Handling and OOPS Advanced (2 Hours)


Objective: Learn file handling and advanced OOPS.
 Time Breakdown:
o 1 hour: File Handling – Read and Write operations – Lecture (30 min), Hands-on
(30 min).
o 1 hour: Function and Operator Overloading – Lecture (30 min), Hands-on (30
min).
 Key Activities:
o Write a program to read/write data to a file and handle exceptions.
o Implement operator overloading in a class (e.g., adding two objects).
 Assessment: Mini-project: Create a class with file I/O for data storage.
Task:
Create a simple Tkinter application:
 With a label, entry field, and button.
 When the button is clicked, display a message box with the text from the entry field.

Solution:
python
import tkinter as tk
from tkinter import messagebox

def show_message():
text = entry.get()
messagebox.showinfo("Message", f"You entered: {text}")

# Create the main window


root = tk.Tk()
root.title("Simple Tkinter App")

# Create widgets
label = tk.Label(root, text="Enter something:")
entry = tk.Entry(root)
button = tk.Button(root, text="Show Message", command=show_message)

# Place widgets using grid


label.grid(row=0, column=0)
entry.grid(row=0, column=1)
button.grid(row=1, column=0, columnspan=2)

# Run the application


root.mainloop()
Explanation:
This task introduces GUI development using Tkinter. It creates a window with a label, text entry,
and button. Clicking the button triggers a function that retrieves the entry text and displays it in a
message box.

Day 5: Exception Handling and GUI Introduction (3 Hours)


Objective: Cover exception handling and begin GUI development with Tkinter.
 Time Breakdown:
o 1 hour: Exception Handling – Errors, Try/Except, Finally, User-Defined
Exceptions – Lecture (30 min), Hands-on (30 min).
o 1 hour: GUI Introduction – Introduction to GUI Programming, Installing PyCharm
– Lecture (30 min), Hands-on (30 min).
o 1 hour: Tkinter Basics – Making the first window, Titles, and Icons – Lecture (30
min), Hands-on (30 min).
 Key Activities:
o Write a program with exception handling for file operations.
o Create a simple Tkinter window.
 Assessment: Build a Tkinter window with error handling for user input.

Day 6: Advanced GUI (Tkinter) (2 Hours)


Objective: Advance GUI skills with Tkinter layouts and widgets.
 Time Breakdown:
o 1 hour: Tkinter Layouts – Grid layout, Introduction to Widgets – Lecture (30 min),
Hands-on (30 min).
o 1 hour: Tkinter Widgets – Drop-down Menus, ToolBar – Lecture (30 min), Hands-
on (30 min).
 Key Activities:
o Design a Tkinter application with a grid layout and widgets.
 Assessment: Create a Tkinter app with a dropdown menu and toolbar.

Day 7: Web Development Introduction (Django/Flask) (3 Hours)


Objective: Introduce web development with Django and Flask.
 Time Breakdown:
o 1 hour: Web Development Introduction – Introduction to Tools and Techniques –
Lecture (30 min), Hands-on (30 min).
o 1 hour: Django Basics – New Project, Basics of Creating an App – Lecture (30
min), Hands-on (30 min).
o 1 hour: Flask Basics – Flask Web Framework, Routing, Templates – Lecture (30
min), Hands-on (30 min).
 Key Activities:
o Set up a basic Django project and create a simple Flask app with routing.
 Assessment: Build a basic web page using Django or Flask.

Task:
Create a simple Flask application:
 With a route that displays "Hello, World!" at the root URL ( /).
 Another route that takes a name as a parameter and displays "Hello, [name]!"

Solution:
python
from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
return "Hello, World!"
@app.route('/hello/<name>')
def hello_name(name):
return f"Hello, {name}!"

if __name__ == '__main__':
app.run(debug=True)
Explanation:
This task introduces web development with Flask. The @app.route decorator defines URL
endpoints, and the <name> syntax allows dynamic parameters. Running the app starts a local
server (accessible at http://127.0.0.1:5000).

Day 8: Database, API Integration, and Revision (3 Hours)


Objective: Cover database integration, APIs, and review key concepts.
 Time Breakdown:
o 1 hour: Database Management – Introduction to MySQL, Python Interaction with
MySQL – Lecture (30 min), Hands-on (30 min).
o 1 hour: API Integration – Introduction to APIs, Remote APIs – Lecture (30 min),
Hands-on (30 min).
o 1 hour: Revision – Recap of Python Foundations, OOPS, GUI, Web, and
Databases – Discussion (30 min), Hands-on (30 min).
 Key Activities:
o Connect Python to MySQL and perform basic CRUD operations.
o Explore a simple API using Python.
o Review and debug code from previous days.
 Assessment: Practical test: Build a small application integrating Python, Tkinter, and a
database or API.

Task:
Write a Python program that:
 Connects to a MySQL database.
 Inserts a new record into a "students" table.
 Fetches and prints all records from the table.

Solution:
python
import mysql.connector

# Connect to the database


conn = mysql.connector.connect(
host="localhost",
user="your_username",
password="your_password",
database="your_database"
)

cursor = conn.cursor()

# Insert a new record


cursor.execute("INSERT INTO students (name, age) VALUES (%s, %s)",
("Alice", 20))
conn.commit()

# Fetch and print all records


cursor.execute("SELECT * FROM students")
records = cursor.fetchall()
for record in records:
print(record)

# Close the connection


cursor.close()
conn.close()
Explanation:
This task introduces database interaction using the mysql.connector library. It connects to a
MySQL database, inserts a record into a "students" table (assumed to have name and age
columns), and retrieves all records. Replace your_username, your_password, and
your_database with actual credentials.

Notes:
 Coverage of All Stages: The plan covers essential topics from Stages 1, 2, and 3,
including Python Foundations, OOPS, File Handling, GUI (Tkinter), Web Development
(Django/Flask), Database Management, and APIs. Redundant or less critical topics (e.g.,
repeated sessions on shallow/deep copy or layouts) are omitted or consolidated to fit the
20-hour limit.
 Time Management: Each session includes breaks (e.g., 10–15 minutes after every hour)
to maintain focus, ensuring effective learning within the 2–3 hour daily constraint.
 Hands-on Emphasis: Each session includes significant hands-on practice to align with
the methodology (Lecture, Discussion, Hands-on, Demo) and ensure practical skills.
 Assessment Integration: Formative assessments are embedded daily, with a final
practical test on Day 8 to evaluate overall understanding.

You might also like