From 3018a816617789d0ed1837bf8b6aa57e2bd12b7b Mon Sep 17 00:00:00 2001 From: rafael <30427560+rafrafavi@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:51:09 +0800 Subject: [PATCH] A template for your answers --- kba.md | 35 +++++++++++++++++++++++++++++++++++ report.md | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 kba.md create mode 100644 report.md diff --git a/kba.md b/kba.md new file mode 100644 index 0000000..66f76d8 --- /dev/null +++ b/kba.md @@ -0,0 +1,35 @@ +# Overview +Provide brief answers to the knowledge-question worksheet. + +## Answers + +1. Briefly explain what is modular programming + +My answer is such and such.... + + +2. How can you import only a specific function or class from a module in Python? What is the syntax for this? + +My answer is such and such.... + +3. How would you explain Python's parameter-passing mechanism? Is it more similar to pass-by-value or pass-by-reference? Justify your answer. + +etc... + +4. Given the following Python code, what will be the output and why? + + ```python + def modify_list(list_): + list_.append("new") + list_ = ["completely", "new"] + + items = ["original"] + modify_list(items) + print(items) + ``` + + +5. In Python, even though variables created within a function are local, there are still situations where you can modify data outside the scope with a local variable. Explain this anomaly and relate it to both mutability and pass by reference. + + +6. List two benefits of modular coding approaches. How do these benefits assist in the development of medium-sized applications? \ No newline at end of file diff --git a/report.md b/report.md new file mode 100644 index 0000000..7142e1d --- /dev/null +++ b/report.md @@ -0,0 +1,39 @@ +# Overview +Provides a report addressing the following questions: + +```text +Justification for your refactoring decisions. +The challenges you would have faced maintaining and testing the original monolithic code. +How you would modify your refactored code to handle a custom-sized tic-tac-toe game (larger than 3x3), and how this implementation would be easier to handle than in the original code. +``` + +## Justification + +I refactored the code into classes because ... ... it provides the following benefits: + +1. benefit +2. benefit +3. benefit + +Without the refactoring, the code would have faced the following challenges: +1. challenge +2. challenge + +## Handling Custom-Sized Tic-Tac-Toe + +My implementation can handle custom sizes because: +1. reason +2. reason +3. reason + +On the other hand, the original code could not handle custom sizes because: +1. reason +2. reason +3. reason + +## Conclusion + +The activity allowed me to practice refactoring and to understand the benefits of object-oriented programming. I learned that ... ... and I will apply this knowledge in future projects. + + +