Python: Tutorial, Projects & Course Syllabus
Python programming from fundamentals to automation, data and backend use cases.
Who this is for
Students, engineers and professionals
Before you start
Python 3 and basic lists/dictionaries.
Summarise lesson attendance with Python
Use dictionaries for named fields and a loop for accumulation.
Separate calculation from printing so the function can be tested.
Set up your practice environment
Save as attendance.py and run python3 attendance.py.
def attendance(rows):
result = {}
for row in rows:
name = row['student']
result.setdefault(name, 0)
if row['present']:
result[name] += 1
return result
rows = [{'student':'A', 'present': True},
{'student':'B', 'present': False},
{'student':'A', 'present': True}]
assert attendance([]) == {}
assert attendance(rows) == {'A': 2, 'B': 0}
print(attendance(rows))Expected result
Walk through the example
- setdefault initializes a missing count without overwriting an existing one.
- Only present lessons increment the count.
- Assertions verify the function for both populated and empty input.
Common mistake
The string "False" is truthy in Python. Parse CSV booleans explicitly.
Try it yourself
Return both total scheduled sessions and attended sessions for each student.
Reveal suggested solution
Initialize result[name] to {"scheduled":0,"attended":0}, increment scheduled for every row and attended only when present.
Portfolio project brief
Read a synthetic CSV attendance file, validate rows and generate a weekly summary.
Acceptance criteria
- Handle missing and invalid values.
- Test duplicate and empty input.
- Do not use real student data in public examples.
This is a project specification, not a completed downloadable project. Build and test it independently or with a mentor.
Quick self-test
Choose one answer per question, then check your score. No sign-in required.
Complete learning roadmap
These are suggested course modules, not a claim that every module has a full tutorial on this site.
- 01Python fundamentals
- 02Functions & modules
- 03OOP
- 04Files & APIs
- 05Automation
- 06Project track: web/data/AI
Learning outcomes
- Write Python programs
- Automate tasks
- Prepare for data/AI tracks
Continue with official documentation
Original PCDS learning material. Check the official documentation for your installed software version; these guides are not vendor-endorsed courses.
Need help learning Python?
Choose a city and describe your learning goal in the enquiry form. Mention Python, your current level and whether you prefer home or online learning. Tutor availability and pricing are subject to confirmation.
Browse Python tutoring options in Mira Road or select a city above.
