diff --git a/.vscode/launch.json b/.vscode/launch.json index 4342f4c90..b5ac3f602 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { "name": "ET: Debug Python (unittest)", "type": "debugpy", diff --git a/.vscode/settings.json b/.vscode/settings.json index 139d42a9a..fad4a7aab 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -131,4 +131,3 @@ "python.testing.pytestEnabled": false, "python.testing.unittestEnabled": true } - diff --git a/README.md b/README.md index 6f35c2b00..58f0dcfd8 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,127 @@ -# California Group +# MIT G#23 - California Group ๐ŸŒ‰ + +
+ Description of the GIF +
-Welcome to **California Group**, +## **Welcome!** -California is dedicated to fostering a culture of trust, respect, and accountability -while promoting open communication and efficient collaboration. Our goal is to -create an environment that values diverse perspectives, encourages teamwork, and -drives success. We support continuous learning and innovative thinking, enhancing -our collaborative efforts. Our shared commitment to growth and development empowers + ![alt text]() + +We are proudly part of the + **MIT Computer and Data Science Foundations Track _2024-2025_** + +**California** is dedicated to fostering a culture of trust, respect, and + accountability +while promoting open communication and efficient collaboration. + Our goal is to +create an environment that values diverse perspectives, + encourages teamwork, and +drives success. We support continuous learning and innovative thinking. +Our shared commitment to growth and development empowers each member to contribute and learn from collective experiences, ensuring we work together effectively to achieve success. +_____ -## Meet the Team +## Meet the Team ๐ŸŒž๐ŸŒด Each member brings something special to the table. -- **Ava**: Turning coffee into code โ˜•โžก๏ธ๐Ÿ’ป -- **Saeee**: Every mistake is progress, and Teamwork fuels growth โ„ข๏ธ ๐Ÿค– -- **Nahom**: We ask not for a lighter burden, but for broader shoulders. ๐Ÿ’ช๐ŸŒ -- **WuorBhang**: Like comedy! making people laugh ๐Ÿ˜ƒ -- **Novel Yonas**: I can spend 8 hrs in GYM -- **Hasan**: I breath Cyber Secur1ty ๐Ÿฅท๐Ÿผ๐Ÿ›ก๐Ÿ’ป +- [**Ava:**](https://github.com/ciiyaa) Turning coffee into code โ˜•โžก๏ธ๐Ÿ’ป +- [**Saeed:**](https://github.com/Saeed-Emad) Every mistake is progress, + and Teamwork fuels growth โ„ข๏ธ ๐Ÿค– +- [**Nahom:**](https://github.com/phoenix27522) We ask not for a lighter burden, + but for broader shoulders. ๐Ÿ’ช๐ŸŒ +- [**WuorBhang:**](https://github.com/WuorBhang) Like comedy! + making people laugh ๐Ÿ˜ƒ +- [**Novel Yonas:**](https://github.com/Novel-Y) I can spend 8 hrs in GYM +- [**Hasan:**](https://github.com/Hasan-Z) I breath Cyber Secur1ty ๐Ÿฅท๐Ÿผ๐Ÿ›ก๐Ÿ’ป +- [**Cynthia:**](https://github.com/Cynthia-Wairimu) Crafting solutions, + one line of code at a time. ๐Ÿ’ปโœจ +- [**Sadam:**](https://github.com/Urz1) Turning data into dreams with + the power of AI & ML ๐Ÿค–โœจ +- [**Ibrahim:**](https://github.com/Ibrahim-Elmisbah) Obsessed with creating and + spotting logical fallacies ๐Ÿค“๐Ÿ”๐Ÿง  +- [**Anyak:**](https://github.com/Anyak7) Technology is the future, +and we are the builders. Let's code, learn, and grow together! + +_____ + +## About This Repository ๐Ÿ„ + +![alt text]() + +This repository is part of the MIT Emerging Talent - Foundation Track program. +It is a dedicated space for learning and practicing Python programming, +as well as improving skills in documentation, testing, +and code review to build a strong foundation in software development. +We achieve this culmination through three key milestones: + +### ๐Ÿš€ Project Kick-Off + +We began with a clear vision to tackle a range of coding challenges, +communication rules, group norms and project workflow. + +### ๐Ÿงฉ Challenges and Solutions + +Throughout the project, we developed a variety of Python solutions +addressing challenges in **mathematics, string processing, geometry, +and logical operations**. Each solution is modular, concise, +and rigorously tested for reliability using both _unittests_ and inline _doctests_. + +### โœ… Finalization and Project Closure + +In the final phase, we ensured all solutions were +thoroughly tested and refined, ready for use and future development. +This phase marked the successful completion of our collaborative effort. + +The `solutions/` directory contains all solutions, each targeting a specific problem. + +_Unittests_ are located in the `solutions/tests/` folder to ensure accuracy and +robustness, covering a wide range of scenarios, including edge cases. + +## Running Tests + +To run all available _unittests_, execute the following from the root directory: + +```bash +python -m unittest discover -v +``` + +_Doctests_ are embedded within the scripts and can be run directly in +**Python** for quick checks. + +_____ + +## Repo Structure + +``` plaintext +MIT-Emerging-Talent-Foundation-Track/ +โ”œโ”€โ”€ .github/ +โ”œโ”€โ”€ .vscode/ +โ”œโ”€โ”€ assets/ +โ”œโ”€โ”€ collaboration/ +โ”‚ โ”œโ”€โ”€ guide/ +โ”‚ โ”œโ”€โ”€ Communication.md +โ”‚ โ”œโ”€โ”€ Constraints.md +โ”‚ โ”œโ”€โ”€ Learning_goals.md +โ”‚ โ”œโ”€โ”€ README.md +โ”‚ โ”œโ”€โ”€ Retrospective.md +โ”œโ”€โ”€ solutions/ +โ”‚ โ”œโ”€โ”€ tests/ +```` + +_____ + +## License + +This project is licensed under the MIT License. +For more details, see the `LICENSE` file. + +_____ + +
+ Description of the GIF +
diff --git a/assets/California flag.gif b/assets/California flag.gif new file mode 100644 index 000000000..099f319a8 Binary files /dev/null and b/assets/California flag.gif differ diff --git a/assets/California intro.gif b/assets/California intro.gif new file mode 100644 index 000000000..486c8981e Binary files /dev/null and b/assets/California intro.gif differ diff --git a/assets/Welcome to California.gif b/assets/Welcome to California.gif new file mode 100644 index 000000000..004d91576 Binary files /dev/null and b/assets/Welcome to California.gif differ diff --git a/assets/california-beach.gif b/assets/california-beach.gif new file mode 100644 index 000000000..81119c9dc Binary files /dev/null and b/assets/california-beach.gif differ diff --git a/assets/california-flag 2.gif b/assets/california-flag 2.gif new file mode 100644 index 000000000..422142a44 Binary files /dev/null and b/assets/california-flag 2.gif differ diff --git a/collaboration/README.md b/collaboration/README.md index 0a18ab57d..0dca88033 100644 --- a/collaboration/README.md +++ b/collaboration/README.md @@ -1,119 +1,81 @@ -# Collaboration +# ๐Ÿค Collaboration -## Group Norms Summary +## ๐ŸŒŸ Group Norms Summary -Our team prioritizes productivity through clear communication, timely task - delivery, and collaborative problem-solving. We hold efficient, purposeful - meetings and make decisions democratically. By fostering a supportive - environment, we ensure every member's contributions drive - progress toward our shared goals. +Our team prioritizes productivity through: +๐Ÿ“ฃ Clear communication +โฐ Timely task delivery +๐Ÿค” Collaborative problem-solving +We hold efficient, purposeful meetings ๐Ÿ—“๏ธ and make decisions democratically. +By fostering a supportive environment ๐Ÿซ‚, we ensure every member's contributions +drive progress toward our shared goals. -## Group Norms for Effective Collaboration +## ๐Ÿš€ Group Norms for Effective Collaboration -### 1. Building Trust +### 1. ๐Ÿค Building Trust -- Trust is built through action: deliver tasks on - time, with quality, and clarity. -- Foster trust by assuming good intentions and maintaining - honesty and transparency. -- Acknowledge each member's contributions regularly and openly. -- Clearly define tasks, deadlines, and expectations to avoid misunderstandings. -- Respect othersโ€™ time and schedules, and ask for help when needed. +- โœ… Deliver tasks on time, with quality and clarity. +- ๐Ÿ›ก๏ธ Foster trust through honesty and transparency. +- ๐ŸŽ‰ Acknowledge contributions regularly and openly. +- ๐Ÿ“Œ Define tasks, deadlines, and expectations clearly. +- ๐Ÿ•’ Respect othersโ€™ time and ask for help when needed. -### 2. Strengthening Relationships +### 2. ๐Ÿค— Strengthening Relationships -- Listen actively during discussions, ensuring everyone feels heard. -- Avoid interrupting or dismissing othersโ€™ ideas. -- Avoid personalizing conflicts and focus on solutions. -- Show appreciation for teammates' efforts and celebrate collective successes. -- Use constructive feedback to resolve disagreements, offering - solutions rather than criticism. +- ๐Ÿ›‘ Avoid interrupting or dismissing othersโ€™ ideas. +- ๐Ÿ‘‚ Listen actively to ensure everyone feels heard. +- ๐Ÿ› ๏ธ Focus on solutions, not personalizing conflicts. +- ๐Ÿ™Œ Show appreciation and celebrate successes. +- โœ๏ธ Use constructive feedback to resolve disagreements. -### 3. Communication Practices +### 3. ๐Ÿ’ฌ Communication Practices -- Use Google Meet for major decisions and updates. -- Slack or WhatsApp is preferred for detailed discussions and quick questions. -- Keep dedicated project files organized and accessible to everyone. -- Share meeting notes, updates, and agendas on Slack for transparency. +- ๐Ÿ“ž Use Google Meet for major updates and decisions. +- ๐Ÿ’ป Use Slack or WhatsApp for quick questions and discussions. +- ๐Ÿ“‚ Keep files organized and accessible to all. +- ๐Ÿ“ Share meeting notes and updates on Slack for transparency. -### 4. Meetings and Coordination +### 4. ๐Ÿ—“๏ธ Meetings and Coordination -- Plan meetings using Slack polls and finalize times with Google Calendar. -- Assign roles for smooth coordination: - - **Coordinator**: Manage meetings and oversee organization. - - **Vice-Coordinator**: Record outcomes and handle updates. - - **Technical Supervisor**: Oversee project technicalities and support the team. -- Meetings should only be held when they add value. -- Set the agenda for each meeting during the previous one to ensure preparedness. -- Wait a maximum of 5 minutes for late members before proceeding. -- Start and end meetings on time, adhering to a clear agenda. -- Promote open communication about scheduling preferences and potential conflicts. +- ๐Ÿ—ณ๏ธ Plan meetings with Slack polls, finalize times on Google Calendar. +- ๐ŸŽฏ Assign roles for smooth coordination: + - **Coordinator**: Manages meetings and organization. + - **Vice-Coordinator**: Records outcomes and updates. + - **Technical Supervisor**: Oversees technical aspects. +- ๐Ÿ•” Wait a max of 5 minutes for late members before proceeding. +- โฑ๏ธ Start and end meetings on time with a clear agenda. -### 5. Balancing Discussions and Debates +### 5. โš–๏ธ Balancing Discussions and Debates -- Prioritize discussions over debates in most cases. -- Engage in discussions to explore ideas and seek consensus. -- Reserve debates for situations with well-formed differing opinions. -- Define the purpose of each debate, avoid redundancy, and listen to diverse perspectives. +- ๐Ÿ’ก Prioritize discussions over debates for most decisions. +- ๐Ÿค Seek consensus during discussions. +- ๐Ÿ”„ Reserve debates for clear, differing opinions. +- ๐ŸŽฏ Focus debates on specific purposes and diverse perspectives. -### 6. Decision-Making and Conflict Resolution +### 6. ๐Ÿ—ณ๏ธ Decision-Making and Conflict Resolution -- Discuss disagreements calmly in dedicated meetings. -- Use a democratic approach: - - In meetings: Quick voting, with the majority deciding. - - Online: Slack or WhatsApp polls with a 12-hour response window. +- ๐Ÿค” Discuss disagreements calmly in meetings. +- ๐Ÿ—ณ๏ธ Use democratic voting: + - **Meetings**: Majority vote. + - **Online**: Slack or WhatsApp polls (12-hour response). -### 7. Rebuilding Trust When Broken +### 7. ๐Ÿ”„ Rebuilding Trust When Broken -- Address concerns openly and focus on solutions rather than assigning blame. -- Take responsibility for mistakes and commit to improvement. -- Reset expectations and work collaboratively to rebuild confidence. +- ๐Ÿค— Address concerns openly and focus on solutions. +- ๐Ÿค Take responsibility for mistakes and commit to improving. +- ๐Ÿ“… Reset expectations and rebuild confidence together. -### 8. Respectful Collaboration +### 8. ๐Ÿค Respectful Collaboration -- Respect is shown by acknowledging ideas, even if theyโ€™re not adopted. -- Constructive disagreements involve proposing alternatives or seeking solutions. -- Avoid ignoring deadlines, input, or contributions from team members. +- ๐Ÿค— Acknowledge ideas, even if not adopted. +- โœ๏ธ Propose alternatives when disagreeing constructively. +- ๐Ÿšซ Avoid ignoring deadlines or team contributions. -### 9. Fostering Positivity and Inclusion +### 9. ๐ŸŒŸ Fostering Positivity and Inclusion -- Use emoji codes for quick replies and a "compliments jar" in Slack - to recognize contributions. -- During challenging discussions, pause to ensure everyone feels heard. - -## Team Introduction - -Welcome to our project! We're excited to share a bit about the vibrant team - behind the scenes. Each member brings unique talents and personalities that - contribute to our success. Hereโ€™s a little introduction to our team: - -## Meet Our Team ๐ŸŽ‰ - -### 1. Wuor Bhang - -- Fun Fact: I like comedy! Whether itโ€™s stand-up or witty banter, - I love what make people laugh. It's all about bringing joy and a positive - vibe to our work! - -### 2. Novel Yonas - -- Fun Fact: I can spend 8 hrs in GYM. - -### 3. [Team Member Name] - -- Fun Fact: [Fun fact or something theyโ€™d like to share.] - -### 4. [Team Member Name] - -- Fun Fact: [Fun fact or something theyโ€™d like to share.] - -### 5. [Team Member Name] - -- Fun Fact: [Fun fact or something theyโ€™d like to share.] - -### 6. [Team Member Name] - -- Fun Fact: [Fun fact or something theyโ€™d like to share.] +- ๐Ÿ˜„ Use emoji codes for quick responses. +- ๐ŸŽ Keep a "compliments jar" in Slack to recognize contributions. +- ๐Ÿ™‹ Pause during challenging discussions to ensure everyone is heard. diff --git a/collaboration/communication.md b/collaboration/communication.md index 0ac9fdfa0..d36a74bb1 100644 --- a/collaboration/communication.md +++ b/collaboration/communication.md @@ -4,50 +4,50 @@ everything you write here will be public so share only what you are comfortable sharing online you can share the rest in confidence with you group by another channel --> -# Communication +# ๐Ÿ“ก Communication --- -## Communication Guidelines +## ๐Ÿ“ Communication Guidelines This document outlines our team's communication practices and expectations. ### **General Principles** -- Communicate clearly and respectfully. -- Keep discussions focused on tasks, challenges, and solutions. -- Use the appropriate channel for each type of communication to maintain efficiency. +- ๐Ÿ—ฃ๏ธ Communicate clearly and respectfully. +- ๐ŸŽฏ Keep discussions focused on tasks, challenges, and solutions. +- ๐Ÿ”„ Use the appropriate channel for each type of communication to maintain efficiency. --- -## Communication Channels +## ๐Ÿ“ฌ Communication Channels Here is how weโ€™ll use our channels: -- **GitHub Issues**: +- **๐Ÿ“Œ GitHub Issues**: - Use issues to track tasks and share updates on progress. - Provide clear, actionable comments when discussing challenges or asking for clarification. -- **Pull Requests (PRs)**: +- **๐Ÿ”„ Pull Requests (PRs)**: - Use PRs to propose changes and review code collaboratively. - Include detailed descriptions of what the PR addresses. - Follow the PR review process: reviewers provide constructive feedback, and authors respond promptly. -- **Slack/WhatsApp**: +- **๐Ÿ’ฌ Slack/WhatsApp**: - Use for quick updates, scheduling calls, or informal discussions. - Use designated threads. -- **Video Calls (Google Meet)**: - - Reserved for in-depth discussions, presentations, or team retrospectives. - - Ensure the agenda is shared as an issue beforehand to make the most - of everyone's time, and share the MoM after the meeting +- **๐ŸŽฅ Video Calls (Google Meet)**: + - Reserved for deep dives, presentations, or retrospectives. + - Share the agenda in advance to respect everyoneโ€™s time. + - Share the ๐Ÿ“ MoM (Minutes of Meeting) afterward --- -## Availability +## โฐ Availability -### **Calling and Messaging Availability** +### **๐Ÿ“ž Calling and Messaging Availability** ### **Team Availability Schedule** @@ -67,6 +67,8 @@ Here is how weโ€™ll use our channels: `โœ“` = Available `โœ˜` = Unavailable +## ๐Ÿ“Š Team Commitment + ### How many hours everyone has per day 1. WuorBhang: _5h_; @@ -79,12 +81,15 @@ Here is how weโ€™ll use our channels: 8. Ibrahim Elmisbah: _2h_; 9. Nahom Tekle: _4h_; -## Asking for Help +## ๐Ÿ™‹ Asking for Help There's a fine line between confidently learning from your mistakes, and stubbornly getting nowhere. Here is a general guide for when to ask for help based on how long you've been stuck on the same problem: -1. _0 -> 60 min_: Try on your own -2. _60 -> 120 min_: Ask your group for help -3. _120+ min_: Tag your coaches in Slack or GitHub +1. ๐Ÿง  **0 -> 60 min**: Try it yourself. You got this! ๐Ÿ’ช +2. ๐Ÿ’ฌ **60 -> 120 min**: Ask your group for guidance. + Teamwork makes the dream work! โœจ +3. ๐Ÿšจ **120+ min**: Tag your coaches on Slack or GitHub. Donโ€™t hesitate! ๐Ÿ‘ฉโ€๐Ÿซ๐Ÿ‘จโ€๐Ÿซ + +Letโ€™s communicate, collaborate, and conquer! ๐Ÿš€ diff --git a/collaboration/constraints.md b/collaboration/constraints.md index af7919554..086aad0d3 100644 --- a/collaboration/constraints.md +++ b/collaboration/constraints.md @@ -1,11 +1,13 @@ -# Constraints +# ๐Ÿšง Constraints -Some boundaries around our project are here now live. +Some boundaries around our project are now live and in action! ๐ŸŽฏ +Letโ€™s stay on track and deliver with focus. ๐Ÿ’ช -## External +--- +## ๐ŸŒ External Constraints +These are the non-negotiables, folks. Letโ€™s roll with them: -**1. Deadline:** Ensure the project is completed and tested before 10th/Jan/2025. +**1. Deadline:** ๐Ÿ•’ Complete and test the project by **12th/Jan/2025**. ๐Ÿ—“๏ธ -**2. Code Review:** The code must pass at least 4 unit tests to be considered complete. +**2. Code Review:** โœ… Code must pass at least **4 unit tests** to be considered complete. -**3. Libraries:** Use only standard Python libraries and `pytest` for testing. +**3. Libraries:** ๐Ÿ“š Use only **standard Python libraries** and `pytest` for testing. -**4. Version Control:** Use Git and GitHub for collaboration. Main branch - protection enabled. +**4. Version Control:** ๐Ÿ”— Collaboration is through **Git** and **GitHub**, with + main branch protection enabled. -**5. Packaging:** Ensure the module is packaged for installation using `setup.py`. +**5. Packaging:** ๐Ÿ“ฆ Ensure the module is packaged for installation using `setup.py`. -## Internal: Involuntary +## ๐Ÿ  Internal: Involuntary Constraints -**1. Daily Time Commitment:** Each team member commits at least 2 hours per day - to work on his/her own project. +1. โณ **Daily Time Commitment**: Each team member dedicates at least + **2 hours/day** to their project. -**2. Hardware:** All team members must use devices capable of running - Python 3.10.0 or higher. +2. ๐Ÿ’ป **Hardware**: All team members must use devices capable of running +**Python 3.10.0+**. -## Internal: Voluntary +## ๐Ÿค Internal: Voluntary Constraints +Hereโ€™s what weโ€™ve agreed upon to scope the project effectively: -**1. Language and Frameworks:** +### ๐Ÿ› ๏ธ **Language and Frameworks** -- Use Python (minimum version 3.10.0). +- ๐Ÿš€ Use **Python** (minimum version **3.10.0**). **(a). Naming Conventions:** -- File names must be in lowercase and use underscores (e.g., `good_fruit_names.py`). +- ๐Ÿ“‚ File names: Must be lowercase with underscores (e.g., `good_fruit_names.py`) -- Testing files must follow the naming pattern `test_.py` (e.g., `test_good_fruit_names.py`). +- ๐Ÿ“‚ Test files: Follow `test_.py` (e.g., `test_good_fruit_names.py`). **(b). Collaboration Tools:** -- Use GitHub Issues and Projects for task tracking. +- ๐Ÿ“‹ Use **GitHub Issues** and **Projects** for task tracking. -- Use Slack for communication. +- ๐Ÿ’ฌ Communicate via **Slack** and **WhatsApp**. -**2. Team Roles:** +--- - **(a). Developer:** Writes the main logic for the module. - - **(b). Tester:** Develops unit tests and ensures code coverage. - - **(c). Documenter:** Prepares project documentation, including a README.md file. - - **(d). Reviewer:** Reviews pull requests before merging to the main branch. - -**3. Scope of the Module:** - -- Input: A name (string). - -- Output: Boolean value indicating if the name contains consecutive identical letters. - -- Edge cases: Handle special characters, empty strings, and numeric values gracefully. - -**4. Documentation:** - -- Include a README file with clear instructions on usage. - -- Provide example input and output. +๐ŸŽ‰ Letโ€™s stick to these constraints and make our project shine! ๐Ÿš€ diff --git a/collaboration/guide/0_repository_setup.md b/collaboration/guide/0_repository_setup.md index c48f383da..0f62ab428 100644 --- a/collaboration/guide/0_repository_setup.md +++ b/collaboration/guide/0_repository_setup.md @@ -14,8 +14,9 @@ it for collaboration: - Change your [repository description](https://stackoverflow.com/questions/7757751/how-do-you-change-a-repository-description-on-github) - Add or remove topics from your repository - - Update your main README with your group name and an initial - overview of your project. (You can change this as much as you want.) + - Update your main README with your group name and + an initial + overview of your project. (You can change this as much as you want.) - Under settings in your repository select: - _Issues_ - _Projects_ diff --git a/collaboration/learning_goals.md b/collaboration/learning_goals.md index 1b3fc093e..1b23eda0c 100644 --- a/collaboration/learning_goals.md +++ b/collaboration/learning_goals.md @@ -85,6 +85,14 @@ strategies. - Master data analysis tools for geophysical and geochemical data interpretation. - Understand and adapt geo-modelling scripts for customized environmental applications. +### **Sadam Husen** + +- Dive deeper into advanced machine learning and AI techniques, focusing on +real-world applications. + +- Contribute to projects that leverage AI for social impact, aiming for ethical +and inclusive solutions. + --- ## ๐ŸŒŸ Why These Goals Matter diff --git a/collaboration/retrospective.md b/collaboration/retrospective.md index ef1974f8f..960abe126 100644 --- a/collaboration/retrospective.md +++ b/collaboration/retrospective.md @@ -1,82 +1,83 @@ -# Retrospective +# ๐Ÿ”„ Retrospective -## Stop Doing +Reflecting on our journey helps us grow stronger as a team! ๐ŸŒŸ +Hereโ€™s what weโ€™ve learned and how weโ€™ll evolve for the next project. ๐Ÿš€ -- Overwriting code during merge conflicts without resolving - them collaboratively. +--- + +## ๐Ÿ›‘ Stop Doing -- Working in isolation for too long without syncing progress with the team. - -- Committing untested code, which led to integration issues. - -## Continue Doing +- โŒ Overwriting code during merge conflicts without resolving them + collaboratively. +- ๐Ÿ› ๏ธ Working in isolation for too long without syncing progress +with the team. +- ๐Ÿšซ Committing untested code, which led to integration issues. + +--- -- Regularly using GitHub to track progress and organize tasks. - -- Writing clear and descriptive commit messages to improve traceability. - -- Sharing updates during team check-ins to stay aligned. - -## Start Doing +## โœ… Continue Doing + +- ๐Ÿ“Š Regularly using **GitHub** to track progress and organize tasks. +- โœ๏ธ Writing clear and descriptive **commit messages** to improve traceability. +- ๐Ÿค Sharing updates during **team check-ins** to stay aligned. + +--- -- Implementing a formal process for handling merge conflicts collaboratively. - -- Scheduling more frequent sync sessions to review and integrate changes - incrementally. +## ๐ŸŒŸ Start Doing -- Conducting mandatory code reviews before merging changes into the main branch. +- ๐Ÿค Implementing a formal process for handling **merge conflicts** collaboratively. +- ๐Ÿ“† Scheduling more frequent sync sessions to review and integrate changes incrementally. +- ๐Ÿ” Conducting **mandatory code reviews** before merging changes into the main branch. +- ๐Ÿ“š Writing **modular and well-documented code** to ease collaboration. -- Writing modular and well-documented code to ease collaboration. - -## Lessons Learned +--- -- Communication is key to preventing duplicated efforts and resolving conflicts - efficiently. +## ๐Ÿ“š Lessons Learned -- Merge conflicts are manageable with proper workflows and proactive conflict +- ๐Ÿ’ก **Communication is key** to preventing duplicated efforts and resolving + conflicts efficiently. +- ๐Ÿ› ๏ธ Merge conflicts are manageable with proper workflows and proactive resolution practices. +- ๐Ÿ”„ Regular integration reduces the chances of encountering large, complex conflicts. +- โœ๏ธ Clear documentation helps the team understand and build on each other's work. +- ๐Ÿค Always make sure that your teammates are on the same page with you. + +--- + +## โš–๏ธ Strategy vs. Board -- Regular integration reduces the chances of encountering large, complex - conflicts. +### โœ… What parts of your plan went as expected? -- Clear documentation helps the entire team understand and build on each - other's work. +- ๐Ÿ“‹ Tasks were tracked and organized effectively using **GitHub**. +- ๐Ÿ•’ Milestones were met on time for specific deliverables. +- ๐Ÿ‘ Most team members followed the planned development workflow. --- -## Strategy vs. Board +### โŒ What parts of your plan did not work out? -### What parts of your plan went as expected? +- โšก Handling merge conflicts wasnโ€™t planned adequately, causing delays. +- ๐Ÿ”‡ Communication gaps led to duplicated work and inconsistencies in code integration. -- Tasks were tracked and organized effectively using GitHub. - -- Milestones were met on time for specific deliverables. - -- Most team members followed the planned development workflow. - -### What parts of your plan did not work out? +--- + +### โž• Did you need to add things that weren't in your strategy? -- Handling merge conflicts was not planned adequately and caused delays. - -- Communication gaps led to duplicated work and inconsistencies in code - integration. +- ๐Ÿ› ๏ธ Introduced a process for **resolving merge conflicts** collaboratively. +- ๐Ÿค Added extra **sync sessions** for better coordination. +- ๐Ÿ” Established steps for **pull request reviews** and mandatory code reviews +before merging. -### Did you need to add things that weren't in your strategy? +--- -- Introduced a process for resolving merge conflicts and added extra sync - sessions for better coordination. -- Added steps to review pull requests and conduct code reviews before merging. - -### Or remove extra steps? +### โž– Or remove extra steps? -- Removed redundant tasks that became unnecessary due to shifting project - priorities. -- Simplified parts of the strategy to focus more on conflict resolution - and integration. +- ๐Ÿšฎ Removed redundant tasks that became unnecessary due to shifting priorities. +- โœ‚๏ธ Simplified parts of the strategy to focus on **conflict resolution and integration**. --- -This retrospective highlights areas for improvement while celebrating the - team's successes, ensuring better collaboration and outcomes in the next project. +๐ŸŽ‰ This retrospective captures our strengths and areas for improvement, +paving the way for even greater success in future projects! ๐Ÿ’ช diff --git a/notes/README.md b/notes/README.md index 17e0f0ded..28b85e182 100644 --- a/notes/README.md +++ b/notes/README.md @@ -1 +1,21 @@ # Notes + +## Purpose + +The `notes/` folder serves as a placeholder for future documentation and additional +resources. However, meeting agendas, minutes of meetings (MoMs), and other +collaborative notes are managed and shared using the repository's **Issues** section. + +## Meeting Management + +- **Meeting Agendas**: Agendas for upcoming meetings are prepared and shared through + GitHub Issues to ensure all team members are aligned before the meeting. + Agenda Issues are titled according to the meeting sequence. +- **Minutes of Meetings (MoMs)**: After each meeting, the key points, decisions, + and action items are documented in the same Issues section for easy tracking. + +## How to Access Meeting Notes + +1. Navigate to the **Issues** tab in the repository. +2. Look for label `Meeting` to quickly find relevant notes. +3. Use the search functionality to locate specific topics or past meeting discussions. diff --git a/solutions/README.md b/solutions/README.md index f6b33d37b..5f74323ba 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -1,5 +1,69 @@ -# Solutions +# ๐ŸŒŸ**Welcome to the Python Playground** ๐Ÿš€ -This README file is for the writing of the challenges of the MIT Foundation - group project of Code challenge on Codewar. - The solutions are written in Python. +Welcome to the **Solutions HQ** โ€“ where creativity meets problem-solving! +Here, you'll find an epic collection of Python-powered solutions, tackling +coding challenges with finesse. Written by a diverse team of passionate coders, +this repository is the ultimate showcase of teamwork and innovation. Dive in, +explore, and let the problem-solving adventures begin! ๐Ÿ’ก + +--- + +## ๐Ÿ“ **Table of Contents** + +Every solution is a story. Here's what we have for you: + +| ๐Ÿ”ข **#** | ๐Ÿท๏ธ **File Name** | โœ๏ธ **Author** | ๐Ÿ› ๏ธ **Description**| +|----------|-----------------------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| 1 | [add_binary.py](./add_binary.py) | Abraham Anyak | Add and manipulate binary numbers like a pro. ๐Ÿ’ป | +| 2 | [calculate_bmi.py](./calculate_bmi.py) | Cynthia-Wairimu | Calculate BMI and unlock the mysteries of weight categories! ๐Ÿ’ช | +| 3 | [double_letter.py](./double_letter.py) | WuorBhang | Hunt down consecutive duplicate letters using recursion. ๐Ÿ”„ | +| 4 | [friend_or_foe.py](./friend_or_foe.py) | Cynthia-Wairimu | Find your true friends โ€“ filter out the foes! ๐Ÿค | +| 5 | [is_even_number.py](./is_even_number.py) | Saeed Ali | Decide whether a number is even or odd with style. โš–๏ธ | +| 6 | [is_prime.py](./is_prime.py) | Ibrahim-Elmisbah | Test your number's prime-time status! ๐ŸŒŸ | +| 7 | [is_square.py](./is_square.py) | WuorBhang | Find out if a number is perfectly square. โฌ› | +| 8 | [is_unique.py](./is_unique.py) | Ava Abdullah | Check if a string is truly one of a kind. ๐ŸŒŸ | +| 9 | [length_of_longest_substring.py](./length_of_longest_substring.py) | SADAM HUSEN ALI | Solve the mystery of the longest substring without repeats. โœจ | +| 10 | [longest_palindromic_substring.py](./longest_palindromic_substring.py) | Nahom Tekle | Unravel the longest palindromic substring โ€“ magic guaranteed! โœจ | +| 11 | [max_area.py](./max_area.py) | SADAM HUSEN ALI | Determine the maximum area of water a container can hold. ๐ŸŒŠ | +| 12 | [most_frequent_character.py](./most_frequent_character.py) | Ava Abdullah | Identify the most frequent character in a string. ๐Ÿ” | +| 13 | [palindrome_checker.py](./palindrome_checker.py) | Hasan Zemzem | Spot palindromes โ€“ strings that read the same backward and forward. ๐Ÿ”„ | +| 14 | [pascal_triangle.py](./pascal_triangle.py) | Nahom Tekle | Generate Pascal's triangle โ€“ math never looked so cool! ๐Ÿ”บ | +| 15 | [review_date_calculator.py](./review_date_calculator.py) | Novel Yonas | Plan spaced repetition like a time management wizard! โณ | +| 16 | [specific_gravity_calculator.py](./specific_gravity_calculator.py) | Novel Yonas | Calculate the specific gravity of substances โ€“ science meets simplicity! โš—๏ธ | +| 17 | [square_number.py](./square_number.py) | Saeed Ali | Square numbers like a math maestro. ๐Ÿ”ข | +| 18 | [sum.py](./sum.py) | Abraham Anyak | Compute the sum of two numbers effortlessly. โž• | +| 19 | [sum_proper_divisors.py](./sum_proper_divisors.py) | Ibrahim-Elmisbah | Calculate the sum of proper divisors with mathematical finesse. โž— | +| 20 | [vowel_counter.py](./vowel_counter.py) | Hasan Zemzem | Count vowels like a linguistic genius! ๐Ÿ”ค | + +--- + +## ๐ŸŒŸ **Why This Repository Rocks** + +- ๐Ÿ **Python Power:** Every solution is written in Python โ€“ sleek, modern, +and powerful. +- ๐ŸŒ **Team Collaboration:** Crafted by talented group members from all +walks of life. +- ๐Ÿ’ก **Diverse Challenges:** From binary operations to palindrome magic +thereโ€™s something for everyone. +- ๐Ÿ“š **Learning Opportunity:** Dig into the code and uncover +pro-level techniques and logic. + +--- + +## ๐Ÿค **Contributing** + +Got ideas? Spotted bugs? Want to make it even cooler? +We welcome all contributions! Open a pull request or start a discussion +in the Issues section. Letโ€™s make this repository even more amazing together! + +--- + +## โš–๏ธ **License** + +This repository is licensed under the MIT License. +Check out the [LICENSE](./LICENSE) file for details. + +--- + +๐ŸŽ‰ **Happy Coding!** +Stay curious, keep learning, and always aim for the stars! ๐ŸŒŒ diff --git a/solutions/check_straight_line.py b/solutions/check_straight_line.py deleted file mode 100644 index dede53e12..000000000 --- a/solutions/check_straight_line.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Module for checking if a set of coordinates lie on a straight line. -""" - -from typing import List - - -class Solution: - """ - A solution to determine if given points lie on a straight line. - """ - - def check_straight_line(self, coordinates: List[List[int]]) -> bool: - """ - Determines if the given coordinates form a straight line. - - Arguments: - coordinates: List[List[int]] - - List of 2D coordinates where each coordinate is represented as [x, y]. - - At least two points are required. - - Returns: - bool - - True if all the points lie on a straight line, otherwise False. - - Raises: - ValueError: If less than two points are provided. - """ - - # Defensive assertion - if len(coordinates) < 2: - raise ValueError("At least two points are required to determine a line.") - - # Calculate the slope using differences to avoid floating-point issues - dx = coordinates[1][0] - coordinates[0][0] - dy = coordinates[1][1] - coordinates[0][1] - - # Iterate through the points - for i in range(2, len(coordinates)): - x_diff = coordinates[i][0] - coordinates[i - 1][0] - y_diff = coordinates[i][1] - coordinates[i - 1][1] - - # Use cross multiplication to compare slopes - if dy * x_diff != dx * y_diff: - return False - - return True diff --git a/solutions/is_square.py b/solutions/is_square.py index 2ca824ae9..fe193e7ba 100644 --- a/solutions/is_square.py +++ b/solutions/is_square.py @@ -6,14 +6,14 @@ Module contents: - is_square: checks if a given integer is a perfect square. -Created on XX XX XX +Created on 26th/Dec/22024 @author: WUOR BHANG GATWECH Challenge is from the Codewars website. Defining the square root of a given number: -In this kata, you will create a function that determines whether a non-negative +In this challenge, I will create a function that determines whether a non-negative integer is a perfect square. The function returns `True` if the input is a perfect square and `False` otherwise. diff --git a/solutions/max_coders_chessboard.py b/solutions/max_coders_chessboard.py deleted file mode 100644 index 2ff93e01a..000000000 --- a/solutions/max_coders_chessboard.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -This module provides a function to calculate the maximum number of Coders -that can be placed on an n x n chessboard such that no two Coders attack -each other. It also generates the configuration of the chessboard. -""" - -from typing import List, Tuple - - -def max_coders_chessboard(n: int) -> Tuple[int, List[str]]: - """ - Calculates the maximum number of Coders that can be placed on an n x n - chessboard without any two Coders attacking each other. - - Arguments: - n : int - The size of the chessboard (1 โ‰ค n โ‰ค 1000). - - Returns: - Tuple[int, List[str]] - - The maximum number of Coders that can be placed. - - The configuration of the chessboard as a list of strings. - - Raises: - ValueError: If `n` is not in the range 1 to 1000 inclusive. - - Examples: - >>> max_coders_chessboard(3) - (5, ['C.C', '.C.', 'C.C']) - - >>> max_coders_chessboard(4) - (8, ['C.C.', '.C.C', 'C.C.', '.C.C']) - - >>> max_coders_chessboard(1) - (1, ['C']) - """ - if not (1 <= n <= 1000): - raise ValueError( - "The size of the chessboard must be between 1 and 1000 inclusive." - ) - - count = 0 - board = [] - - for i in range(n): - row = [] - for j in range(n): - if (i + j) % 2 == 0: # Checkerboard pattern - row.append("C") - count += 1 - else: - row.append(".") - board.append("".join(row)) - - return count, board diff --git a/solutions/palindrome_checker.py b/solutions/palindrome_checker.py new file mode 100644 index 000000000..e40c64da7 --- /dev/null +++ b/solutions/palindrome_checker.py @@ -0,0 +1,35 @@ +""" +This module contains a function to check if a string is a palindrome. + +A palindrome is a string that reads the same forward and backward, ignoring spaces, punctuation, and capitalization. +""" + + +def palindrome_checker(s: str) -> bool: + """ + Check if a given string is a palindrome, ignoring spaces, punctuation, and capitalization. + + Parameters: + s (str): The input string to check. + + Returns: + bool: True if the input string is a palindrome, False otherwise. + + Raises: + TypeError: If the input `s` is not a string. + + Example: + >>> palindrome_checker("A man, a plan, a canal: Panama") + True + >>> palindrome_checker("Hello") + False + >>> palindrome_checker("12321") + True + """ + # Defensive assertion: Ensure the input is a string + if not isinstance(s, str): + raise TypeError("Input must be a string") + # Normalize the string: remove non-alphanumeric characters and convert to lowercase + normalized = "".join(char.lower() for char in s if char.isalnum()) + # Check if the normalized string is equal to its reverse + return normalized == normalized[::-1] diff --git a/solutions/review_date_calculator.py b/solutions/review_date_calculator.py new file mode 100644 index 000000000..bcd7ababb --- /dev/null +++ b/solutions/review_date_calculator.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +A module for calculating spaced repetition review days. + +Module contents: + - calculate_review_days: calculates review days based on an initial study day. + +Created on 07/01/2025 + +@author: Novel Yonas + +Spaced Repetition Review Calculator: +This module provides functionality to calculate review days +for a spaced repetition +learning technique. It determines the next four review days based on an initial +study day, with each subsequent review spaced at double the interval of the previous one. + +The main function in this module is 'calculate_review_days', which is defined as follows: + + Calculate spaced repetition review days based on an initial study day. + + Args: + start_day (int): The day of the initial study session (1-31). + + Returns: + list[int]: A list of four spaced repetition review days. + Each subsequent review is spaced at double + the interval of the previous one, ignoring month and year changes. + +""" + + +def calculate_review_days(start_day): + """ + Calculate spaced repetition review days based on an initial study day. + + Args: + start_day (int): The day of the initial study session (1-31). + + Returns: + list[int]: A list of four spaced repetition review days. + Each subsequent review is spaced at double + the interval of the previous one, ignoring month and year changes. + + Examples: + >>> calculate_review_days(1) + [2, 4, 8, 16] + + >>> calculate_review_days(15) + [16, 18, 22, 30] + + >>> calculate_review_days(28) + [29, 31, 4, 12] + + >>> calculate_review_days(30) + [31, 2, 6, 14] + + >>> calculate_review_days(31) + [1, 3, 7, 15] + """ + review_days = [] # Initialize an empty list to store review days + current_day = start_day + interval = 1 # Start with 1 day to the first review + + for _ in range(4): # Loop to calculate four review days + # Calculate the next review day + current_day += interval + + # Adjust the day if it exceeds 31 + if current_day > 31: + current_day -= 31 + + review_days.append(current_day) # Add the calculated day to the list + interval *= 2 # Double the interval for the next review + + return review_days # Return the list of review days diff --git a/solutions/specific_gravity_calculator.py b/solutions/specific_gravity_calculator.py new file mode 100644 index 000000000..abea5bd1f --- /dev/null +++ b/solutions/specific_gravity_calculator.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +A module for calculating the specific gravity of a substance. + +Module contents: + - calculate_specific_gravity: calculates the specific gravity of a substance given its density. + +Created on 06/01/2025 + +@author: Novel Yonas + +Specific Gravity Calculator: +This module provides functionality to calculate the specific gravity +of a substance. +Specific gravity is a dimensionless quantity that compares the density of a substance +to the density of a reference substance (typically water at 4ยฐC, which has a density +of 1000 kg/mยณ). + +The specific gravity is calculated using the formula: +Specific Gravity = Density of substance / Density of reference substance + +In this module, we use water at 4ยฐC as the reference substance, with a density of 1000 kg/mยณ. + +Usage: + The main function in this module is 'calculate_specific_gravity', which takes + the density of a substance as input and returns its specific gravity. +""" + + +def calculate_specific_gravity(a, w): + """ + Calculates the specific gravity of a rock mass. + + Args: + a: Float, weight of the rock mass measured in air. + w: Float, weight of the rock mass measured in water. + + Returns: + Float: The specific gravity of the rock mass. + None: If the weight in air is less than or equal to the weight in water. + + Raises: + ValueError: If invalid inputs are provided or the calculation cannot proceed. + + Examples: + >>> calculate_specific_gravity(4, 2) + 2.0 + >>> calculate_specific_gravity(5, 2) + 1.6666666666666667 + >>> calculate_specific_gravity(2, 2) + + """ + if a <= w: + return None # Return None to indicate an error + return a / (a - w) diff --git a/solutions/tests/README.md b/solutions/tests/README.md index 89c0dd1eb..4685fa514 100644 --- a/solutions/tests/README.md +++ b/solutions/tests/README.md @@ -1,3 +1,47 @@ -# Tests +# ๐ŸŽ‰Test Solutions README ๐ŸŽ‰ -This is where all the tests file documentation are found. +Welcome to the **Testing Playground**โ€”where bugs fear to tread and code proves +its worth! ๐Ÿ’ป๐Ÿž This isnโ€™t just about testing; itโ€™s about showing your solutions +whoโ€™s boss while having some serious fun. Ready to dive in? ๐Ÿš€ + +--- + +## ๐ŸŒŸ Testing Ideas Galore + +Testing isnโ€™t just a choreโ€”itโ€™s an adventure! ๐Ÿง—โ€โ™‚๏ธ Your mission: push each +solution to its limits, find its quirks, and uncover those hidden edge cases. +Each solution has its own personality; letโ€™s get to know them better: + +| **Solution** | **How to Challenge It** | +|------------------------------------- |-----------------------------------------------------------| +| **`add_binary.py`** | Test with large binary numbers . | +| **`calculate_bmi.py`** | Try with extreme heights/weights | +| **`double_letter.py`** | Test with words like `"apple"`, and `"Aaahhh"`.| +| **`friend_or_foe.py`** | Use lists with various names,friends/random.| +| **`is_even_number.py`** | Check with large and small numbers,`0`.| +| **`is_prime.py`** | Test primes, non-primes, and edge case numbers| +| **`is_square.py`** | Test perfect squares & non-squares numbers| +| **`is_unique.py`** | Try words with duplicates.| +| **`length_of_longest_substring.py`** | Test with strings`"abcabcbb"`& empty ones.| +| **`palindromic_substring.py`** | Check with strings like `"racecar"`&`"a"`| +| **`max_area.py`** | Test with random wall heights for area calculation.| +| **`most_frequent_character.py`** | Test with strings of varied lengths.| +| **`palindrome_checker.py`** |Test sentences with punctuation and spaces.| +| **`pascal_triangle.py`** |Check if the triangles are correct | +| **`review_date_calculator.py`** | Test with varied intervals and schedules.| +| **`specific_gravity_calculator.py`** | Validate with liquids, solids, and extremes.| +| **`square_number.py`** | Try `0`, negatives, and perfect squares.| +| **`sum.py`** | Add integers, decimals, and large numbers.| +| **`sum_proper_divisors.py`** | Try primes, composites, and perfect numbers| +| **`vowel_counter.py`** | Count vowels in short/long,mixed-case strings| + +## ๐ŸŽ‰ Make Testing a Blast + +Who says testing canโ€™t be fun? + +- **Compete with Friends:** Who can write the sneakiest edge case ๐Ÿ‘ฏ +- **Bug Hunt:** Spot that one stubborn bugโ€”victory is yours! ๐Ÿ•ต๏ธโ€โ™€๏ธ +- **Celebrate Wins:** When it works, do a little happy dance! ๐Ÿ’ƒ + +Ready to make these solutions shine? Test away, have a laugh, and build some +bulletproof code! ๐Ÿ’ช๐ŸŽŠ diff --git a/solutions/tests/test_check_straight_line.py b/solutions/tests/test_check_straight_line.py deleted file mode 100644 index 745446dd7..000000000 --- a/solutions/tests/test_check_straight_line.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -Unit tests for the check_straight_line module. -""" - -import unittest -from solutions.check_straight_line import Solution - - -class TestCheckStraightLine(unittest.TestCase): - """ - Test cases for the Solution class's checkStraightLine method. - """ - - def test_all_points_on_line(self): - """ - Test that the function correctly identifies points on a straight line. - """ - solution = Solution() - coordinates = [[1, 2], [2, 3], [3, 4]] - self.assertTrue(solution.check_straight_line(coordinates)) - - def test_points_not_on_line(self): - """ - Test that the function correctly identifies points not on a straight line. - """ - solution = Solution() - coordinates = [[1, 1], [2, 2], [3, 4]] - self.assertFalse(solution.check_straight_line(coordinates)) - - def test_vertical_line(self): - """ - Test that the function works for vertical lines. - """ - solution = Solution() - coordinates = [[2, 1], [2, 3], [2, 5]] - self.assertTrue(solution.check_straight_line(coordinates)) - - def test_insufficient_points(self): - """ - Test that the function raises an exception for fewer than two points. - """ - solution = Solution() - coordinates = [[1, 1]] - with self.assertRaises(ValueError): - solution.check_straight_line(coordinates) - - def test_horizontal_line(self): - """ - Test that the function works for horizontal lines. - """ - solution = Solution() - coordinates = [[1, 2], [3, 2], [5, 2]] - self.assertTrue(solution.check_straight_line(coordinates)) - - def test_boundary_case(self): - """ - Test that the function handles edge cases for large input ranges. - """ - solution = Solution() - coordinates = [[-1000000, -1000000], [0, 0], [1000000, 1000000]] - self.assertTrue(solution.check_straight_line(coordinates)) - - -if __name__ == "__main__": - unittest.main() diff --git a/solutions/tests/test_max_coders_chessboard.py b/solutions/tests/test_max_coders_chessboard.py deleted file mode 100644 index 4e665a003..000000000 --- a/solutions/tests/test_max_coders_chessboard.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -Unit tests for the max_coders_chessboard function. -""" - -import unittest -from solutions.max_coders_chessboard import max_coders_chessboard - - -class TestMaxCodersChessboard(unittest.TestCase): - """ - Unit tests for the `max_coders_chessboard` function. - """ - - def test_small_board(self): - """Test the function with a small board size.""" - self.assertEqual(max_coders_chessboard(3), (5, ["C.C", ".C.", "C.C"])) - - def test_even_sized_board(self): - """Test the function with an even-sized board.""" - self.assertEqual( - max_coders_chessboard(4), (8, ["C.C.", ".C.C", "C.C.", ".C.C"]) - ) - - def test_single_cell_board(self): - """Test the function with a single-cell board.""" - self.assertEqual(max_coders_chessboard(1), (1, ["C"])) - - def test_invalid_board_size(self): - """Test the function raises an error for invalid board size.""" - with self.assertRaises(ValueError): - max_coders_chessboard(0) - - def test_large_board(self): - """Test the function with a large board size.""" - n = 1000 - result = max_coders_chessboard(n) - self.assertEqual(result[0], (n * n + 1) // 2) # Check max coders count - self.assertEqual(len(result[1]), n) # Check board size - - -if __name__ == "__main__": - unittest.main() diff --git a/solutions/tests/test_palindrome_checker.py b/solutions/tests/test_palindrome_checker.py new file mode 100644 index 000000000..d0a86cfdb --- /dev/null +++ b/solutions/tests/test_palindrome_checker.py @@ -0,0 +1,105 @@ +""" +This module contains unit tests for the `palindrome_checker` function in `palindrome_checker.py`. + +The `palindrome_checker` function determines whether a string is a palindrome, ignoring spaces, +punctuation, and capitalization. +""" + +import unittest + +from solutions.palindrome_checker import palindrome_checker + + +class TestPalindromeChecker(unittest.TestCase): + """ + Unit tests for the `palindrome_checker` function. + """ + + # Test cases where the input string is a palindrome + def test_palindrome_phrase(self): + """ + Test a palindrome phrase with punctuation and spaces. + """ + self.assertTrue(palindrome_checker("A man, a plan, a canal: Panama")) + + def test_palindrome_single_word(self): + """ + Test a single-word palindrome. + """ + self.assertTrue(palindrome_checker("Racecar")) + + def test_palindrome_numeric(self): + """ + Test a numeric palindrome. + """ + self.assertTrue(palindrome_checker("12321")) + + def test_palindrome_empty_string(self): + """ + Test an empty string as a palindrome. + """ + self.assertTrue(palindrome_checker("")) + + # Test cases where the input string is not a palindrome + def test_non_palindrome_single_word(self): + """ + Test a non-palindrome word. + """ + self.assertFalse(palindrome_checker("Hello")) + + def test_non_palindrome_phrase(self): + """ + Test a non-palindrome phrase. + """ + self.assertFalse(palindrome_checker("Not a palindrome")) + + # Test edge cases + def test_edge_case_single_letter(self): + """ + Test a single-letter string. + """ + self.assertTrue(palindrome_checker("a")) + + def test_edge_case_single_space(self): + """ + Test a single space character. + """ + self.assertTrue(palindrome_checker(" ")) + + def test_edge_case_special_characters(self): + """ + Test a string with only special characters. + """ + self.assertTrue(palindrome_checker("!!")) + + def test_edge_case_mixed_phrase(self): + """ + Test a complex palindrome phrase with mixed case and punctuation. + """ + self.assertTrue(palindrome_checker("Able , was I saw eLba")) + + # Defensive assertion tests + def test_invalid_input_type_integer(self): + """ + Test that the function raises a TypeError for non-string input (integer). + """ + with self.assertRaises(TypeError): + palindrome_checker(12345) + + def test_invalid_input_type_list(self): + """ + Test that the function raises a TypeError for non-string input (list). + """ + with self.assertRaises(TypeError): + palindrome_checker(["a", "b", "c"]) + + def test_invalid_input_type_none(self): + """ + Test that the function raises a TypeError for non-string input (None). + """ + with self.assertRaises(TypeError): + palindrome_checker(None) + + +if __name__ == "__main__": + unittest.main() diff --git a/solutions/tests/test_review_date_calculator.py b/solutions/tests/test_review_date_calculator.py new file mode 100644 index 000000000..056b8e120 --- /dev/null +++ b/solutions/tests/test_review_date_calculator.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Unit test class for the `calculate_review_days` function. + +This class contains test cases to validate the functionality +and edge cases of the +`calculate_review_days` function, ensuring it handles various input scenarios correctly +and produces the expected output for spaced repetition review schedules. + +The test suite aims to comprehensively cover the function's behavior, including: +- Correctness of the calculated review days. +- Proper handling of month transitions. +""" + +import unittest + +from solutions.review_date_calculator import calculate_review_days + + +class TestCalculateReviewDays(unittest.TestCase): + """Unit tests for the calculate_review_days function.""" + + def test_start_day_1(self): + """Test case for start day 1.""" + self.assertEqual(calculate_review_days(1), [2, 4, 8, 16]) + + def test_start_day_15(self): + """Test case for start day 15.""" + self.assertEqual(calculate_review_days(15), [16, 18, 22, 30]) + + def test_start_day_30(self): + """Test case for start day 30.""" + self.assertEqual(calculate_review_days(30), [31, 2, 6, 14]) + + def test_start_day_31(self): + """Test case for start day 31.""" + self.assertEqual(calculate_review_days(31), [1, 3, 7, 15]) + + def test_start_day_edge(self): + """Test case for an edge start day 28.""" + self.assertEqual(calculate_review_days(28), [29, 31, 4, 12]) diff --git a/solutions/tests/test_specific_gravity_calculator.py b/solutions/tests/test_specific_gravity_calculator.py new file mode 100644 index 000000000..ddc600810 --- /dev/null +++ b/solutions/tests/test_specific_gravity_calculator.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Unit test class for the `calculate_specific_gravity` function. + +This class contains test cases to validate the functionality +and edge cases of the +`calculate_specific_gravity` function, ensuring it handles valid inputs, invalid inputs, +and edge conditions gracefully. + +Test cases include: +- Valid inputs where the specific gravity is correctly calculated. +- Cases where the weight in air equals or is less than the weight in water. +- Inputs with negative values to check for proper error handling. +""" + +import unittest + +from solutions.specific_gravity_calculator import calculate_specific_gravity + + +class TestCalculateSpecificGravity(unittest.TestCase): + """specific_gravity_calculator""" + + def test_valid_input(self): + """Test with valid inputs.""" + self.assertAlmostEqual(calculate_specific_gravity(4, 2), 2.0) + self.assertAlmostEqual(calculate_specific_gravity(5, 2), 1.6666666666666667) + + def test_equal_weights(self): + """Test when weight in air is equal to weight in water.""" + self.assertIsNone(calculate_specific_gravity(2, 2)) + + def test_weight_in_air_less_than_water(self): + """Test when weight in air is less than weight in water.""" + self.assertIsNone(calculate_specific_gravity(1, 2)) + + def test_invalid_inputs(self): + """Test with invalid inputs like negative values.""" + self.assertIsNone(calculate_specific_gravity(-4, 2)) + self.assertIsNone(calculate_specific_gravity(-4, -2)) diff --git a/solutions/tests/test_vowel_counter.py b/solutions/tests/test_vowel_counter.py index 0cd93dc62..d9cb2df10 100644 --- a/solutions/tests/test_vowel_counter.py +++ b/solutions/tests/test_vowel_counter.py @@ -1,7 +1,7 @@ """ This module contains unit tests for the vowel_counter module. It includes test cases for the following function: -- count_vowels: Test the function that counts vowels in a string. +- vowel_counter: Test the function that counts vowels in a string. Tests cover various cases including normal strings, empty strings, and case insensitivity. @@ -12,7 +12,7 @@ import unittest -from ..vowel_counter import count_vowels +from ..vowel_counter import vowel_counter class TestVowelCounter(unittest.TestCase): @@ -20,28 +20,65 @@ class TestVowelCounter(unittest.TestCase): Test suite for the vowel_counter module. """ - def test_count_vowels(self): + def test_vowel_counter_hello_world(self): """ - Test the count_vowels function. + Test the vowel_counter function with the string 'Hello World'. + Expect 3 vowels: 'e', 'o', 'o'. """ - # Test for different cases - self.assertEqual(count_vowels("Hello World"), 3) # 'e', 'o', 'o' - self.assertEqual(count_vowels("Python"), 1) # 'o' - self.assertEqual(count_vowels("aeiou"), 5) # all vowels - self.assertEqual(count_vowels("XYZ"), 0) # no vowels - self.assertEqual(count_vowels("HELLO WORLD!"), 3) # 'E', 'O', 'O' + self.assertEqual(vowel_counter("Hello World"), 3) - def test_count_vowels_empty(self): + def test_vowel_counter_python(self): """ - Test count_vowels for empty string. + Test the vowel_counter function with the string 'Python'. + Expect 1 vowel: 'o'. """ - self.assertEqual(count_vowels(""), 0) # No vowels in an empty string + self.assertEqual(vowel_counter("Python"), 1) - def test_count_vowels_case_sensitive(self): + def test_vowel_counter_all_vowels(self): """ - Test that the count_vowels function is case-insensitive. + Test the vowel_counter function with the string 'aeiou'. + Expect 5 vowels: all vowels are present. """ - self.assertEqual(count_vowels("AaEeIiOoUu"), 10) # All vowels, case-insensitive + self.assertEqual(vowel_counter("aeiou"), 5) + + def test_vowel_counter_no_vowels(self): + """ + Test the vowel_counter function with the string 'XYZ'. + Expect 0 vowels: no vowels are present. + """ + self.assertEqual(vowel_counter("XYZ"), 0) + + def test_vowel_counter_uppercase(self): + """ + Test the vowel_counter function with the string 'HELLO WORLD!'. + Expect 3 vowels: 'E', 'O', 'O'. + """ + self.assertEqual(vowel_counter("HELLO WORLD!"), 3) + + def test_vowel_counter_case_sensitive(self): + """ + Test that the vowel_counter function is case-insensitive. + Expect 10 vowels: 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u'. + """ + self.assertEqual( + vowel_counter("AaEeIiOoUu"), 10 + ) # All vowels, case-insensitive + + # Defensive assertion tests + def test_invalid_input_type_integer(self): + """Test that the function raises a TypeError for non-string input (integer).""" + with self.assertRaises(TypeError): + vowel_counter(12345) + + def test_invalid_input_type_list(self): + """Test that the function raises a TypeError for non-string input (list).""" + with self.assertRaises(TypeError): + vowel_counter(["a", "b", "c"]) + + def test_empty_string(self): + """Test that the function raises a ValueError for an empty string.""" + with self.assertRaises(ValueError): + vowel_counter("") if __name__ == "__main__": diff --git a/solutions/vowel_counter.py b/solutions/vowel_counter.py index 9e5bab0a0..3a56f5af1 100644 --- a/solutions/vowel_counter.py +++ b/solutions/vowel_counter.py @@ -3,29 +3,47 @@ The function considers vowels as 'a', 'e', 'i', 'o', 'u' in both lowercase and uppercase. Function: -- count_vowels: Counts vowels in a provided string. +- vowel_counter: Counts vowels in a provided string. Example: - >>> count_vowels("Hello World") + >>> vowel_counter("Hello World") 3 """ -def count_vowels(text): +def vowel_counter(text) -> int: """ Counts the number of vowels in the provided text. Vowels are considered to be 'a', 'e', 'i', 'o', 'u' (both lowercase and uppercase). - Args: + Parameters: text (str): The input string to count vowels in. + The purpose of this argument is to provide the text where the vowels (a, e, i, o, u) are searched for. Returns: int: The number of vowels in the input string. + Raises: + TypeError: If the input `text` is not a string. + ValueError: If the input `text` is an empty string. + Example: - >>> count_vowels("Hello World") + >>> vowel_counter("Hello World") 3 + >>> vowel_counter("Hasan") + 2 + >>> vowel_counter("Shy myths fly by.") + 0 """ + # Defensive assertion: Ensure the input is a string + if not isinstance(text, str): + raise TypeError("Input must be a string") + + # Defensive assertion: Ensure the string is not empty + if not text: + raise ValueError("Input string cannot be empty") + + # Define vowels and count occurrences vowels = "aeiouAEIOU" return sum(1 for char in text if char in vowels)