Stage 3 – Complete

Coding5s / Pillar 1 / Stage 03

Complete

Stage 3 moves from diagnosis to construction. The learner receives a partially completed technical artifact with meaningful pieces intentionally removed, then uses the surrounding context, requirements, and expected behavior to determine what is missing and complete it.

READ CONTEXT FIND THE GAP REASON COMPLETE VERIFY
Reference output: Below is a complete example of a Stage 3 lesson generated through the Coding5s prompt architecture. The missing components, surrounding context, expected results, and completion tasks vary according to the topic, technology, learner level, and configured technical rules.

🔹 Topic #23 | Stage 3 🧩 Complete | Python Core & Scripting | 📊 Level: Intermediate | 🌐 Coding5s.com

Concept: Conditional Branching (if, elif, else)

Dataset detected: NO. Generating dummy data.

📥 From: Marcus Vance – Tech Lead
📤 To: Junior – Python Core & Scripting Developer

Subject: Need your help closing out these routing modules

Hi, I’ve structured the base code, please handle the core logic. Complete the # TODOs. The output must match exactly. Cheers.

🚨 Your objective in this lesson: You must copy the code blocks from each Challenge exactly as they are and paste them into your IDE, then write the missing lines in the code until you achieve the exact Expected Output when running the program.

Challenge 1️⃣: Calculate Package Shipping Cost (Score 3)

🎯 Objective: Implement a basic multi-way conditional branch to assign shipping costs based on weight thresholds.

💻 Expected Output:

Plaintext
Weight: 3kg -> Cost: $10
Weight: 8kg -> Cost: $20
Weight: 25kg -> Cost: $50

Incomplete Code:

Python
def calculate_shipping(weight):
    cost = 0
    # TODO: Implement conditional logic using if, elif, and else.
    # If weight is 20 or more, cost is 50.
    # If weight is 5 or more, cost is 20.
    # Otherwise, cost is 10.
    pass

    return cost

packages = [3, 8, 25]
for p in packages:
    print(f"Weight: {p}kg -> Cost: ${calculate_shipping(p)}")

Challenge 2️⃣: Categorize User Age Demographics (Score 4)

🎯 Objective: Write the correct if, elif, and else blocks to categorize users based on age ranges.

💻 Expected Output:

Plaintext
Age 10 is categorized as: Child
Age 15 is categorized as: Teen
Age 25 is categorized as: Adult
Age 18 is categorized as: Teen

Incomplete Code:

Python
def categorize_user(age):
    category = "Unknown"
    
    # TODO: Use if, elif, and else to set the correct category.
    # Less than 13 is 'Child'
    # 13 up to 19 (inclusive) is 'Teen' (Hint: strictly less than 20)
    # 20 and over is 'Adult'
    pass

    return category

users = [10, 15, 25, 18]
for u in users:
    print(f"Age {u} is categorized as: {categorize_user(u)}")

Challenge 3️⃣: Assign Academic Letter Grades (Score 4)

🎯 Objective: Complete a partially written conditional structure by adding the missing elif and else branches.

💻 Expected Output:

Plaintext
Score: 95 -> Grade: A
Score: 82 -> Grade: B
Score: 74 -> Grade: C
Score: 55 -> Grade: F

Incomplete Code:

Python
def assign_grade(score):
    if score >= 90:
        return "A"
    # TODO: Add an elif branch that returns 'B' for 80 or above.
    # TODO: Add an elif branch that returns 'C' for 70 or above.
    # TODO: Add an else branch that returns 'F' for anything lower.
    pass

scores = [95, 82, 74, 55]
for s in scores:
    print(f"Score: {s} -> Grade: {assign_grade(s)}")

Challenge 4️⃣: Determine Loan Eligibility Status (Score 5)

🎯 Objective: Use compound conditions (and / or) inside a multi-way branch to evaluate loan approvals.

💻 Expected Output:

Plaintext
Inc: $60000, Score: 750 -> Approved
Inc: $40000, Score: 720 -> Review
Inc: $30000, Score: 600 -> Denied

Incomplete Code:

Python
def check_loan_eligibility(income, credit_score):
    status = "Pending"
    
    # TODO: Use if, elif, and else to set the status variable.
    # 'Approved' if income >= 50000 AND credit_score >= 700.
    # 'Review' if income >= 50000 OR credit_score >= 700.
    # 'Denied' for all other cases.
    pass

    return status

applicants = [(60000, 750), (40000, 720), (30000, 600)]
for inc, cred in applicants:
    print(f"Inc: ${inc}, Score: {cred} -> {check_loan_eligibility(inc, cred)}")

Coding5s System – Learn Programming by Writing Code – Coding5S.com

Scroll to Top