"""
Mini Project: Student Result & Access System
Purpose: Apply control flow concepts using conditions, loops and boolean logic
Output: Evaluates students, assigns grades, and controls access rules
"""
# -----------------------------
# 1. Project Data
# -----------------------------
students = [
{"name": "Mark", "score": 85, "attendance": 90, "has_id": True},
{"name": "Sara", "score": 58, "attendance": 80, "has_id": True},
{"name": "Aaqid", "score": 92, "attendance": 70, "has_id": False},
{"name": "Lina", "score": 76, "attendance": 88, "has_id": True}
]
# -----------------------------
# 2. Loop through students
# -----------------------------
for student in students:
name = student["name"]
score = student["score"]
attendance = student["attendance"]
has_id = student["has_id"]
print("\nStudent:", name)
# -----------------------------
# 3. Grade evaluation (if-elif-else)
# -----------------------------
if score >= 90:
grade = "A"
elif score >= 75:
grade = "B"
elif score >= 60:
grade = "C"
else:
grade = "F"
print("Grade:", grade)
# -----------------------------
# 4. Pass / Fail logic (boolean logic)
# -----------------------------
if score >= 60 and attendance >= 75:
print("Status: Passed")
else:
print("Status: Failed")
# -----------------------------
# 5. Nested condition (access control)
# -----------------------------
if score >= 60:
if has_id:
print("Certificate: Issued")
else:
print("Certificate: ID required")
else:
print("Certificate: Not eligible")
# -----------------------------
# 6. while loop example (admin check)
# -----------------------------
attempts = 3
password = "admin123"
user_input = ""
while attempts > 0:
user_input = await input("\nEnter admin password: ")
if user_input == password:
print("Admin access granted.")
break
else:
attempts -= 1
print("Wrong password. Attempts left:", attempts)
if attempts == 0:
print("Admin access locked.")
# -----------------------------
# 7. Notes
# -----------------------------
# 1. Uses for loops to process multiple records.
# 2. Uses if-elif-else for decision making.
# 3. Uses boolean logic (and / or / not).
# 4. Uses nested conditions for deeper checks.
# 5. Uses while loop with break for control.
# 6. This structure mirrors real-world systems.