Tirsvad a3321900ca
TirSystem/git-workflows: Release / release (push) Skipped
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Successful in 37s
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Successful in 14s
TirSystem/git-workflows: Publish accepted milestones / publish (push) Successful in 27s
TirSystem/git-workflows: Validate / validate (push) Successful in 51s
TirSystem/git-workflows: OpenGrep / opengrep (push) Successful in 2m21s
Merge pull request 'Bring the project to the framework baseline (MIL-001)' (#7) from mil-001-baseline into main
2026-11-15 12:18:41 +01:00
2026-11-15 19:15:49 +08:00
2026-10-07 16:34:47 +02:00

017-followers

Day 17 of the Udemy 100 Days of Code course: a small example of how to define and use a Python class.

📚 Table of Contents

🧭 Overview

This is a demonstration only. It has no tests and no dependencies.

What it shows

The User class in src/main.py demonstrates:

  • a constructor (__init__) that sets attributes with default values
  • instance attributes (id, username, followers, following)
  • a method (follow) that changes the state of two objects at once
class User:

    def __init__(self, user_id, username):
        self.id = user_id
        self.username = username
        self.followers = 0
        self.following = 0

    def follow(self, user):
        user.followers += 1
        self.following += 1

When user_1.follow(user_2) runs, user_1.following goes up by one and user_2.followers goes up by one.

Layout

Path Purpose
src/main.py The User class and the demo that uses it

📋 Requirements

Python 3. There are no dependencies.

🛠️ Setup

No installation is needed: the program uses only the Python standard library. Clone the repository and run the program from its root.

▶️ Run

python src/main.py

Expected output:

0
1
1
0

The four lines are user_1.followers, user_1.following, user_2.followers and user_2.following.

🧪 Tests

The project has no automated tests. Check that the program compiles:

python -m py_compile src/main.py

📄 License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE.

📎 Appendix: Project documents

The documents a newcomer needs, in reading order.

Document What it tells you
Business Case Why the project exists, its scope and success criteria
Stakeholder Analysis Who is involved; the stakeholder IDs used for owners and reviewers
Project Plan The gateways and their schedule
Milestones One document per gateway: Go/No-Go criteria and tasks
Artifact registry Where each artifact type lives, the next version, the PO language and domain
Traceability matrix How the artifacts link and when each was last reviewed

S
Description
Day 17 of Udemy 100 Days of Code: a small Python example of defining and using a class (User with followers and following counters).
Readme AGPL-3.0
99 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%