diff --git a/summership-26-prs/Pradeep Mishra/README.md b/summership-26-prs/Pradeep Mishra/README.md new file mode 100644 index 0000000..329c883 --- /dev/null +++ b/summership-26-prs/Pradeep Mishra/README.md @@ -0,0 +1,146 @@ +# PyBe Discovery Lab — The Gates of Rajgad + +> An interactive, story-driven learning module that teaches **Python Decorators** through the security protocol of Rajgad Fort (1665 CE). + +--- + +# Overview + +Most Python tutorials explain decorators using abstract examples. This project introduces the concept through a historical story inspired by **Rajgad Fort**, helping learners understand the decorator pattern before seeing any Python code. + +The story follows **Subedar Yesaji Kank**, who follows a strict three-phase security protocol for every royal messenger entering Rajgad Fort. This sequence directly mirrors how a Python decorator works. + +--- + +# Learning Objective + +This project teaches the Python Decorator execution flow: + +``` +BEFORE → MAIN FUNCTION → AFTER +``` + +Example: + +```python +def security(func): + def wrapper(): + print("Before") # Kank checks the Mudra token + result = func() # Messenger delivers the scroll + print("After") # Kank logs the exit in Rojkird + return result + return wrapper + +@security +def deliver_message(): + print("Delivering message") + return "Done" + +deliver_message() +``` + +--- + +# Story + +It is **1665 CE**. + +A royal messenger arrives at **Maha Darwaja**, the main entrance of Rajgad Fort, carrying a sealed scroll for **Chhatrapati Shivaji Maharaj**. + +Before allowing entry, **Subedar Yesaji Kank** verifies the Mudra token and the royal seal. + +After successful verification: + +1. The messenger enters the fort. +2. The message is delivered. +3. The exit is recorded in the **Rojkird** (official fort ledger). + +Every mission follows the same protocol. + +Learners experience this journey through an interactive story before discovering its connection to Python decorators. + +--- + +# Screens + +| Screen | Description | +|---------|-------------| +| Welcome | Introduction to Rajgad Fort | +| Maha Darwaja | Problem statement | +| Inspection by Kank | BEFORE phase | +| Audience with Maharaj | MAIN FUNCTION | +| Rojkird Log | AFTER phase | +| Python Connection | Story mapped to Python code | +| Quiz 1 | Identify the decorator | +| Quiz 2 | Identify the main function | +| Quiz 3 | Identify the AFTER phase | +| Completion | Summary and congratulations | + +--- + +# Features + +- Story-first learning approach +- Interactive quiz with guided feedback +- Story-to-code mapping +- Re-runnable Python terminal animation +- Syntax-highlighted code editor +- BEFORE / MAIN / AFTER phase visualization +- Smooth animations and transitions +- Canvas-based particle effects +- Previous/Next navigation +- Beginner-friendly explanation of Python decorators + +--- + +# Technologies Used + +- HTML5 +- CSS3 +- JavaScript (Vanilla) +- Canvas API +- Google Fonts +- CSS Animations + +--- + +# Project Structure + +``` +pybe-discovery-lab/ +│ +├── index.html +└── assets/ + ├── rajgad_welcome.jpg + ├── step1_arrival.jpg + ├── step2_verification.jpg + ├── step3_durbar.jpg + └── step4_ledger.jpg +``` + +--- + +# Design Decisions + +- **Single-file architecture** for simplicity and easy sharing. +- **No frameworks** to keep the project lightweight. +- **Story-first learning** to help beginners understand decorators intuitively. +- **Historical theme** to make learning engaging and memorable. + +--- + +# Context + +Developed as part of the **PyBe (Python Beginner Experience)** course project. + +The target audience is beginners learning **Python Decorators** for the first time. + +--- + +# Author + +**Pradeep Mishra** + +GitHub: **pradeep-code1** + +Project created as part of the **PyBe Summership** program to explore story-based learning for programming education. \ No newline at end of file diff --git a/summership-26-prs/Pradeep Mishra/assets/rajgad_welcome.jpg b/summership-26-prs/Pradeep Mishra/assets/rajgad_welcome.jpg new file mode 100644 index 0000000..dd75b24 Binary files /dev/null and b/summership-26-prs/Pradeep Mishra/assets/rajgad_welcome.jpg differ diff --git a/summership-26-prs/Pradeep Mishra/assets/step1_arrival.jpg b/summership-26-prs/Pradeep Mishra/assets/step1_arrival.jpg new file mode 100644 index 0000000..4aaf7ba Binary files /dev/null and b/summership-26-prs/Pradeep Mishra/assets/step1_arrival.jpg differ diff --git a/summership-26-prs/Pradeep Mishra/assets/step2_verification.jpg b/summership-26-prs/Pradeep Mishra/assets/step2_verification.jpg new file mode 100644 index 0000000..5b9469a Binary files /dev/null and b/summership-26-prs/Pradeep Mishra/assets/step2_verification.jpg differ diff --git a/summership-26-prs/Pradeep Mishra/assets/step3_durbar.jpg b/summership-26-prs/Pradeep Mishra/assets/step3_durbar.jpg new file mode 100644 index 0000000..a2cca94 Binary files /dev/null and b/summership-26-prs/Pradeep Mishra/assets/step3_durbar.jpg differ diff --git a/summership-26-prs/Pradeep Mishra/assets/step4_ledger.jpg b/summership-26-prs/Pradeep Mishra/assets/step4_ledger.jpg new file mode 100644 index 0000000..7bab2b8 Binary files /dev/null and b/summership-26-prs/Pradeep Mishra/assets/step4_ledger.jpg differ diff --git a/summership-26-prs/Pradeep Mishra/index.html b/summership-26-prs/Pradeep Mishra/index.html new file mode 100644 index 0000000..d5d27d9 --- /dev/null +++ b/summership-26-prs/Pradeep Mishra/index.html @@ -0,0 +1,1436 @@ + + +
+ + +
+ 1665 CE — Sahyadri Mountains, Maharashtra
+राजगड किल्ल्याचे द्वार
+ +
+ Follow Subedar Yesaji Kank — the legendary guardian
+ of Rajgad — and discover the secret of Python Decorators.
+
+
+ + "Late afternoon. A royal messenger arrives at the iron-spiked gates. + Subedar Yesaji Kank stands firm — hand on his shamsher sword. + The messenger shouts urgency. + The gate does not move." +
+The messenger insists his news is urgent. Subedar Kank's response:
+ + +Correct! Subedar Kank verifies first — no exceptions. The gate stays shut until every check passes.
++ A Python Decorator is exactly like Subedar Kank. + When you call a function, the decorator runs its BEFORE check first — + before your function even starts. You cannot skip it. + Just like the gate cannot open before Kank's verification. +
+
+
+ + "Kank holds the copper Mudra to the light. He breaks the wax seal. + He checks every mark against the Royal Seal of Swarajya. + Only then does his hand move toward the bolt." +
+What does Subedar Kank's pre-check achieve?
+ + +Right! Every check is purposeful. Rajgad was never breached because Subedar Kank never skipped this step.
+
+ This is the BEFORE phase of a Python Decorator.
+ The code inside the decorator that runs before calling your function —
+ like checking if a user is logged in, logging the start time, or validating inputs.
+ Kank's Mudra check = decorator's before-code.
+
+
+ + "Subedar Kank nods. The iron bolt slides. The messenger kneels before + Chhatrapati Shivaji Maharaj and delivers the scroll — + his one sacred task. Nothing more. Nothing less." +
+The messenger has one pure purpose. Press to execute it:
+ +Delivered! The core task is complete — pure, uninterrupted purpose.
+
+ The messenger's scroll delivery = your actual function — the one you wrote with def deliver_message():.
+ The decorator doesn't change what the function does.
+ It just runs BEFORE and AFTER it.
+ The MAIN TASK stays pure.
+
+
+ + "Mission complete. The messenger turns to leave. + Subedar Kank opens the Rojkird. + Token number, entry time, exit time — all recorded. + After every mission, the record is eternal." +
+Subedar Kank records the exit. What does this achieve?
+ + +Correct! The record is the final seal. No mission is complete without it.
+
+ The Rojkird log = the AFTER phase of a Python Decorator.
+ Code that runs after your function completes —
+ logging execution time, saving results, sending notifications, cleaning up resources.
+ Kank's exit log = decorator's after-code.
+
See how the Rajgad story maps exactly to Python Decorators
+ + +@security above a function is like assigning Subedar Kank to guard it. From now on, Kank's protocol runs every time you call that function.Correct! The decorator function is Subedar Kank — it runs before and after your function, just like Kank's protocol wraps every mission.
+Exactly right! deliver_message() is the messenger's pure job — the core function. The decorator runs around it, but the function stays clean.
Perfect! print("After") is Kank's Rojkird entry — it runs after the main function completes. You have mastered the three phases! 🏆
+ You have walked through all five gates, witnessed Subedar Kank's protocol,
+ and mastered the three phases of a Python Decorator.
+