Skip to content
This repository was archived by the owner on Dec 13, 2025. It is now read-only.
This repository was archived by the owner on Dec 13, 2025. It is now read-only.

Update the calculation function for all the classes to be the same #2

@eduard-balamatiuc

Description

@eduard-balamatiuc

For the last lessons I used a function that was more clean because it was applying the same logic for all the other smaller function without duplication, implement that same kind of logic for the other classes.

The implementation of that function was in Lesson16, here it is

    def check_task(self, task_number, func):
        task_class = globals()[f"Task{task_number}"]
        solution_task = task_class(func)
        try:
            self.status_tasks[f"task_{task_number}"] = solution_task.check_task()
            if self.status_tasks[f"task_{task_number}"]:
                return f"Task {task_number}: Correct! Well done."
            return f"Task {task_number}: Incorrect! Please try again."
        except:
            return f"Task {task_number}: Error!"

Update this functionality to the other classes as well or propose a better one and then update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions