diff --git a/collaboration/communication.md b/collaboration/communication.md index b666d9698..771b49ecf 100644 --- a/collaboration/communication.md +++ b/collaboration/communication.md @@ -31,9 +31,9 @@ How often we will get in touch on each channel, and what we will discuss there: | Faisal | $TIME$ | $TIME$ | $TIME$ | $TIME$ | $TIME$ | $TIME$ | $TIME$ | | Majd | 6-8 PM | 5-6 PM | 7-9 PM | 5-7 PM |7-9 PM | 6-8 PM | 6-8 PM | | Mohamed| 6-9 PM | 6-9 PM | 6-9 PM | 6-10 PM | 2-9 PM | 6-9 PM | 6-9 PM | -| Obey | $TIME$ | $TIME$ | $TIME$ | $TIME$ | $TIME$ | $TIME$ | $TIME$ | +| Obey | 6-9 PM | 6-9 PM | 6-8 PM | 7-9 PM | 2-10 PM| 5-10 PM | 6-9 PM | | ร–zgรผr | 5-7 PM | 5-7 PM | 5-7 PM | 5-7 PM | 5-7 PM | 5-7 PM | 5-7 PM | -| Razan | 7-9 PM | 9-10 PM | 7-9 PM | 7-9 PM | 7-9 PM | 7-9 PM | 7-9 PM | +| Razan | 7-9 PM | 9-10 PM | 7-9 PM | 7-9 PM | 7-9 PM | 7-9 PM | 7-9 PM | ### How many hours everyone reserves for Code review per day @@ -43,7 +43,7 @@ How often we will get in touch on each channel, and what we will discuss there: - Faisal: $HOURS$ - Majd: 4 hours - Mohamed: 2 hours -- Obey: $HOURS$ +- Obey: 2 hours - ร–zgรผr: 2 hours - Razan: An hour diff --git a/collaboration/learning_goals.md b/collaboration/learning_goals.md index e53b3d958..6b1b32289 100644 --- a/collaboration/learning_goals.md +++ b/collaboration/learning_goals.md @@ -40,8 +40,12 @@ environment that provides support and help to every member in need. - ### **Obey** - - Fully understand python basics from Evan's guides. - Write clear code that is easy to be understood even if it is complex. + - Master advanced coding skills and best practices. + - Collaborate effectively in diverse teams. + - Enhance problem-solving and critical thinking abilities. + - Gain hands-on experience with industry tools and technologies. + - Build a strong professional network with mentors and peers. - ### **Razan Ibrahim** diff --git a/collaboration/retrospective.md b/collaboration/retrospective.md index 74e18813b..4c533905d 100644 --- a/collaboration/retrospective.md +++ b/collaboration/retrospective.md @@ -1,23 +1,156 @@ -# Retrospective +# Project Retrospective: The Matrix ๐Ÿ•ถ๏ธ -## Stop Doing +## Project Highlights ๐ŸŒŸ -## Continue Doing +### 1. What Went Well during the project? โœ… -## Start Doing +- **Collaboration Successes** ๐Ÿค -## Lessons Learned +The team worked cohesively, leveraging each otherโ€™s strengths to accomplish +project goals.Effective communication and collaboration ensured +tasks were completed efficiently. -______________________________________________________________________ +- **Supportive Environment** ๐Ÿ’ช +A strong sense of mutual support within the team helped overcome +challenges and maintain momentum throughout the project. -## Strategy vs. Board +- **Tools and Workflows** ๐Ÿ› ๏ธ -### What parts of your plan went as expected? + - Despite initial learning curves, the team successfully mastered the use of +the project board to organize and manage tasks efficiently by the end of the +project. + - The team collaborated effectively on GitHub, utilizing pull requests (PRs) + for thorough code reviews and ensuring high code quality. -### What parts of your plan did not work out? +- **Regular Updates** ๐Ÿ”„ -### Did you need to add things that weren't in your strategy? + Regular stand-ups and progress updates kept everyone aligned, +ensuring clarity on priorities and reducing misunderstandings. -### Or remove extra steps? +### 2. Achievements ๐Ÿ† + +**Over 300 commits were achieved in under two weeks**, showcasing the teamโ€™s +efficiency and dedication. Furthermore, **the team mastered GitHub workflows**, +such as pull requests and code reviews, while **enhancing collaboration and** +**teamwork skills** through the effective use of communication and task management +tools. + +--- + +## Stop Doing ๐Ÿšซ + +- Resolving merge conflicts independently without collaborating to +ensure all changes are integrated smoothly. +- Submitting code without thorough testing, which led to integration issues. +- Writing overly technical descriptions in issue tickets, making it difficult +for non-programmers to understand. +- Spending too much time solving problems independently +instead of seeking help when needed. + +--- + +## Continue Doing โœ… + +- Maintaining mutual support and collaboration. +- Documenting progress to ensure transparency and alignment within the team. +- Regularly using GitHub to track progress and organize tasks, +leveraging branches and pull requests for better organization. +- Using majority rule through polls to resolve differences of opinion. + +--- + +## Start Doing ๐Ÿš€ + +- Utilize GitHubโ€™s discussion feature more effectively in future projects. +- Systematically record key learnings in the notes document. +- Keep track of changes that impact the entire group. +- Delete obsolete branches promptly after pull request reviews. +- Establish higher standards for pull requests, testing, and communication. + +--- + +## Challenges Encountered โš ๏ธ + +### Key Pain Points ๐Ÿ”‘ + +- Communication and coordination difficulties. +- Technical issues, such as pull request problems and CI check failures. +- Challenges in maintaining consistency across the codebase. + +### Specific Examples ๐Ÿ“Œ + +- Availability challenges: Team members were not always +available simultaneously, causing occasional delays. +- Misalignment in task requirements and expectations, leading to inefficiencies. +- Early misuse of the project board hindered task organization. +- Frustrations with resolving merge conflicts and CI failures. +- Instances of working on the wrong project or branch, resulting in delays and corrections. +- Some team members encountered communication barriers, including challenges in +conveying desired code changes effectively due to language differences. +- Connectivity issues limited access to essential online resources. + +--- + +## Lessons Learned ๐ŸŽ“๐Ÿ’ก + +### Insights Gained ๐Ÿ” + +- Developed a deeper understanding of effective code review practices. +- Enhanced proficiency in GitHub workflows and tools. +- Recognized the importance of constructive feedback and clear communication +for collaboration success. + +### Specific Learnings ๐Ÿ“š + +- Improved communication skills, enabling clearer expression of ideas and insights. +- Learned to request code changes effectively and provide precise, +constructive feedback during reviews. +- Gained expertise in managing merge conflicts proactively with proper workflows. +- Emphasized the importance of regular check-ins to keep the team aligned. +- Discovered the value of teamwork, flexibility, and adaptability in overcoming challenges. + +--- + +## Strategy and Board ๐Ÿ“‹ + +### What parts of your plan went as expected? โœ”๏ธ + +- Successfully completed the expected number of challenges. +- Effectively utilized collaboration and communication tools to share resources +and coordinate tasks efficiently. +- Used GitHub and VS Code as expected, leveraging their features like cloning +repositories, creating pull requests, labeling issues, and tracking tasks. +- Fostered a supportive team environment where members were willing to assist +and support one another. + +### What parts of your plan did not work out? โŒ + +- Merge conflicts were not managed effectively, resulting in delays. +- Communication gaps and language barriers led to duplicated efforts and +inconsistencies during code integration. +- Inefficient use of the project board workflow during early stages hindered organization. +- Time management expectations were not fully met, with the initial voluntary +deadline being missed. +- Resolving errors and CI check failures took more time than anticipated. + +--- + +## Actionable Items for Future Projects ๐Ÿ“ˆ๐ŸŽฏ + +- Develop a standardized process for pull requests and code reviews. +- Implement regular check-ins or progress-tracking meetings, ensuring +unresolved challenges are documented for follow-up. +- Foster proactive communication and hold more frequent meetings to ensure +alignment and address challenges. +- Establish detailed plans with clearly defined milestones, schedules, and +deadlines for each project phase. + +--- + +## Collective Reflection ๐Ÿคโœจ + +The team collaborated effectively despite facing challenges, achieving +significant progress. Moving forward, improved planning, enhanced communication +and efficient task management will ensure smoother execution and even greater success. diff --git a/solutions/README.md b/solutions/README.md index 2ff7d897d..47934840d 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -24,10 +24,13 @@ while corresponding test files are maintained in the `tests` folder. | `calculate_average.py`| Calculates the average of a list of numbers | Clement | | `spiral_traverse.py` | Traverses a 2D matrix in spiral order | Fahed | | `euler_totient.py` | Computes Euler's totient function (ฯ•(n))| Fahed | +| `is_prime.py` | determine whether a given number is prime. | Fahed| +| `gcd.py` | A function to calculate the greatest common divisor (GCD)| Fahed| +| `kronecker_product.py` | Computes the Kronecker โŠ— product of 2 matrices | Fahed| +| `fibonacci.py` | Generates Fibonacci sequences up to n terms | Fahed | | `direction_to_degree.py` | Convert a cardinal direction to degree | Obay | | `check_odd_or_even.py` | Checks if a number is odd or even | Clement | | `grading_system.py`| Assigning letter grade to a numeric score. | Razan | -| `kronecker_product.py` | Computes the Kronecker โŠ— product of 2 matrices | Fahed| | `feet_to_meters.py` | Converting feet to meters| Obay | | `area_circle.py`| Calculates the area of the circle | Majd | | `multiplication.py`| Calculate the multiple of two numbers | Majd| @@ -41,6 +44,8 @@ while corresponding test files are maintained in the `tests` folder. | `check_prime_number.py` | Given a positive int if it is a prime number| ร–zgรผr | | `password_strength.py` | Checks the strength of a password| Anas | | `decimal_to_binary.py` | Converts decimal to its equivalent binary| Anas | +| `is_positive.py` | Determines if a given number is positive | Faisal | +| `is_palindrome.py` | Checks string palindrome properties | Faisal | --- diff --git a/solutions/fibonacci.py b/solutions/fibonacci.py new file mode 100644 index 000000000..2ba05dce9 --- /dev/null +++ b/solutions/fibonacci.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +A module for generating Fibonacci sequences. + +Module contents: +- generate_fibonacci: Generates Fibonacci sequence up to n terms. + +The Fibonacci sequence is a series of numbers where each number is the sum of the two +preceding ones, starting with 0 and 1. + +Author: Fahed Daibes +Created: 12-Jan-2025 +""" + + +def generate_fibonacci(n: int) -> list: + """ + Generates the first n terms of the Fibonacci sequence. + + Parameters: + - n (int): The number of terms to generate. + + Returns: + - list: A list containing the first n terms of the Fibonacci sequence. + + Raises: + - AssertionError: If the input is not a positive integer. + + Examples: + >>> generate_fibonacci(0) + [] + + >>> generate_fibonacci(1) + [0] + + >>> generate_fibonacci(5) + [0, 1, 1, 2, 3] + + >>> generate_fibonacci("five") + Traceback (most recent call last): + ... + AssertionError: Input must be a non-negative integer. + """ + # Defensive check + assert isinstance(n, int) and n >= 0, "Input must be a non-negative integer." + + if n == 0: + return [] + if n == 1: + return [0] + + sequence = [0, 1] + for _ in range(2, n): + sequence.append(sequence[-1] + sequence[-2]) + + return sequence diff --git a/solutions/gcd.py b/solutions/gcd.py new file mode 100644 index 000000000..99e2ebafc --- /dev/null +++ b/solutions/gcd.py @@ -0,0 +1,54 @@ +# !/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +gcd.py + +This module provides a function to calculate the greatest common divisor (GCD) +of two integers using the Euclidean algorithm. + +Author: Fahed Daibes +Date: Jan 12 2025 +Group: ET6-foundations-group-16 +""" + + +def gcd(a: int, b: int) -> int: + """ + Calculates the greatest common divisor (GCD) of two integers. + + Parameters: + - a (int): The first integer. + - b (int): The second integer. + + Returns: + - int: The GCD of the two numbers. + + Raises: + - AssertionError: If either input is not an integer. + + Examples: + >>> gcd(48, 18) + 6 + + >>> gcd(101, 103) + 1 + + >>> gcd(0, 25) + 25 + + >>> gcd(0, 0) + 0 + + >>> gcd("eight", 16) + Traceback (most recent call last): + ... + AssertionError: Both inputs must be integers. + """ + # Defensive check + assert isinstance(a, int) and isinstance(b, int), "Both inputs must be integers." + + while b != 0: + a, b = b, a % b + + return abs(a) diff --git a/solutions/is_positive.py b/solutions/is_positive.py new file mode 100644 index 000000000..4e7d4a530 --- /dev/null +++ b/solutions/is_positive.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +""" +A module for checking if a number is positive. + +Module contents: + - is_positive: Determines if a given number is positive. + +Author: [Your name] +Created: 2025-01-08 +""" + + +def is_positive(n: float) -> bool: + """Determines if a given number is positive. + + A number is considered positive if it is greater than 0. + + Raises: + TypeError: If the input is not a real number (int or float). + + Parameters: + n: float or int, the number to check. + + Returns: + bool: True if the number is greater than 0, False otherwise. + + Examples: + >>> is_positive(5) + True + >>> is_positive(-3) + False + >>> is_positive(0) + False + >>> is_positive(3.14) + True + >>> is_positive(-2.5) + False + """ + if isinstance(n, bool): + raise TypeError("Input must be a real number (int or float)") + if not isinstance(n, (int, float)): + raise TypeError("Input must be a real number (int or float)") + return n > 0 diff --git a/solutions/longest_word.py b/solutions/longest_word.py new file mode 100644 index 000000000..710067670 --- /dev/null +++ b/solutions/longest_word.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + + +""" +A module for Returns the longest word in the given sentence. + +Module contents: + This module contains a function `longest_word` + that takes a sentence and returns the longest word in it. + It handles edge cases such as empty strings, non-string inputs, and punctuation. + +Author: ร–zgรผr ร–zbek +Date: 11th January 2025 +Group: ET6-foundations-group-16 +""" + +import string + + +def longest_word(sentence: str) -> str: + """ + Returns the longest word in the given sentence, ignoring punctuation. + + Args: + sentence (str): A sentence from which to find the longest word. + + Returns: + str: The longest word in the sentence. If there are multiple longest words, + the first one encountered is returned. + + Raises: + AssertionError: If the input is not a string or if the string is empty. + + Example: + >>> longest_word("I love programming with Python") + 'programming' + + >>> longest_word("apple banana cherry!") + 'banana' + + >>> longest_word("Hello, world!") + 'Hello' + + """ + # Defensive assertion to check if the sentence is a non-empty string + assert isinstance(sentence, str), "Input must be a string." + assert sentence, "Input string must not be empty." + + # Split the sentence into words based on spaces + words = sentence.split() + + # Initialize the variable to store the longest word + longest = "" + + # Iterate through each word in the list + for word in words: + # Remove punctuation from the start and end of the word + word = word.strip(string.punctuation) + + # Check if the current word is longer than the longest found so far + if len(word) > len(longest): + longest = word + + return longest diff --git a/solutions/tests/test_fibonacci.py b/solutions/tests/test_fibonacci.py new file mode 100644 index 000000000..7337cabc9 --- /dev/null +++ b/solutions/tests/test_fibonacci.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +test_fibonacci.py + +This module contains unit tests for the `generate_fibonacci` function, which generates +the Fibonacci sequence up to a given number of terms. + +Author: Fahed Daibes +Date: Jan 12 2025 +Group: ET6-foundations-group-16 + +Tests: +- Valid inputs for various sequence lengths. +- Edge cases, such as n=0 and n=1. +- Invalid inputs, such as negative numbers and non-integer types. +""" + +import unittest + +from solutions.fibonacci import generate_fibonacci + + +def assert_fibonacci(expected, n): + """ + Custom assertion function to compare the result of generate_fibonacci with the expected value. + + Parameters: + - expected (list): The expected Fibonacci sequence. + - n (int): The input number of terms. + + Raises: + - AssertionError: If the result of generate_fibonacci does not match the expected value. + """ + result = generate_fibonacci(n) + assert result == expected, f"Expected {expected} for {n}, but got {result}." + + +class TestFibonacci(unittest.TestCase): + """ + This test class contains unit tests for the `generate_fibonacci` function. + + Each test uses only one assertion with the custom `assert_fibonacci` function. + """ + + def test_zero_terms(self): + """Test case for zero terms.""" + assert_fibonacci([], 0) + + def test_one_term(self): + """Test case for one term.""" + assert_fibonacci([0], 1) + + def test_five_terms(self): + """Test case for five terms.""" + assert_fibonacci([0, 1, 1, 2, 3], 5) + + def test_large_sequence(self): + """Test case for a larger sequence.""" + assert_fibonacci([0, 1, 1, 2, 3, 5, 8, 13, 21, 34], 10) + + def test_negative_input(self): + """Test case for negative input.""" + with self.assertRaises(AssertionError): + generate_fibonacci(-3) + + def test_invalid_string(self): + """Test case for an invalid string input.""" + with self.assertRaises(AssertionError): + generate_fibonacci("ten") + + def test_invalid_float(self): + """Test case for an invalid float input.""" + with self.assertRaises(AssertionError): + generate_fibonacci(3.5) + + +if __name__ == "__main__": + unittest.main() diff --git a/solutions/tests/test_gcd.py b/solutions/tests/test_gcd.py new file mode 100644 index 000000000..2afe5d502 --- /dev/null +++ b/solutions/tests/test_gcd.py @@ -0,0 +1,85 @@ +# !/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +test_gcd.py + +This module contains unit tests for the `gcd` function, which calculates the +greatest common divisor (GCD) of two integers. + +Author: Fahed Daibes +Date: Jan 12 2025 +Group: ET6-foundations-group-16 + +Tests: +- Valid inputs, including positive, negative, and zero values. +- Invalid inputs, such as non-integer types. +""" + +import unittest + +from solutions.gcd import gcd + + +def assert_gcd(expected, a, b): + """ + Custom assertion function to compare the result of gcd with the expected value. + + Parameters: + - expected (int): The expected GCD. + - a (int): The first input integer. + - b (int): The second input integer. + + Raises: + - AssertionError: If the result of gcd does not match the expected value. + """ + result = gcd(a, b) + assert result == expected, ( + f"Expected {expected} for gcd({a}, {b}), but got {result}." + ) + + +class TestGCD(unittest.TestCase): + """ + This test class contains unit tests for the `gcd` function. + + Each test uses only one assertion with the custom `assert_gcd` function. + """ + + def test_gcd_positive_numbers(self): + """Test case for two positive numbers.""" + assert_gcd(6, 48, 18) + + def test_gcd_coprime_numbers(self): + """Test case for two coprime numbers.""" + assert_gcd(1, 101, 103) + + def test_gcd_one_zero(self): + """Test case for one number being zero.""" + assert_gcd(25, 0, 25) + + def test_gcd_both_zero(self): + """Test case for both numbers being zero.""" + assert_gcd(0, 0, 0) + + def test_gcd_negative_numbers(self): + """Test case for negative numbers.""" + assert_gcd(6, -48, -18) + + def test_gcd_mixed_signs(self): + """Test case for one positive and one negative number.""" + assert_gcd(6, 48, -18) + + def test_invalid_string_input(self): + """Test case for a string input.""" + with self.assertRaises(AssertionError): + gcd("forty-eight", 18) + + def test_invalid_float_input(self): + """Test case for a float input.""" + with self.assertRaises(AssertionError): + gcd(48.5, 18) + + +if __name__ == "__main__": + unittest.main() diff --git a/solutions/tests/test_is_positive.py b/solutions/tests/test_is_positive.py new file mode 100644 index 000000000..b60257d6f --- /dev/null +++ b/solutions/tests/test_is_positive.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Test module for is_positive function. + +Module contents: +- TestIsPositive: Unit test for the is_positive function. + +Test categories: + - Standard cases: positive numbers, negative numbers, zero + - Edge cases: very large numbers, very small numbers, floating points + - Defensive tests: wrong input types +""" + +import unittest + +from ..is_positive import is_positive + + +class TestIsPositive(unittest.TestCase): + """Test suite for the is_positive function.""" + + # Standard test cases + def test_basic_positive_integer(self): + """It should return True for basic positive integer.""" + self.assertTrue(is_positive(5)) + + def test_basic_negative_integer(self): + """It should return False for basic negative integer.""" + self.assertFalse(is_positive(-5)) + + def test_positive_large_integer(self): + """It should return True for large positive integer.""" + self.assertTrue(is_positive(1000000)) + + def test_negative_large_integer(self): + """It should return False for large negative integer.""" + self.assertFalse(is_positive(-1000000)) + + def test_zero(self): + """It should return False for zero.""" + self.assertFalse(is_positive(0)) + + # Edge cases + def test_very_large_positive_number(self): + """It should handle very large positive numbers correctly.""" + self.assertTrue(is_positive(1e308)) + + def test_very_large_negative_number(self): + """It should handle very large negative numbers correctly.""" + self.assertFalse(is_positive(-1e308)) + + def test_very_small_positive_number(self): + """It should handle very small positive numbers correctly.""" + self.assertTrue(is_positive(1e-308)) + + def test_very_small_negative_number(self): + """It should handle very small negative numbers correctly.""" + self.assertFalse(is_positive(-1e-308)) + + # Floating point tests + def test_positive_float(self): + """It should return True for positive float.""" + self.assertTrue(is_positive(0.1)) + self.assertTrue(is_positive(3.14)) + + def test_negative_float(self): + """It should return False for negative float.""" + self.assertFalse(is_positive(-0.1)) + self.assertFalse(is_positive(-3.14)) + + # Defensive tests + def test_string_input(self): + """It should raise TypeError for string input.""" + with self.assertRaises(TypeError): + is_positive("5") + + def test_none_input(self): + """It should raise TypeError for None input.""" + with self.assertRaises(TypeError): + is_positive(None) + + def test_boolean_true_input(self): + """It should raise TypeError for boolean True input.""" + with self.assertRaises(TypeError): + is_positive(True) + + def test_boolean_false_input(self): + """It should raise TypeError for boolean False input.""" + with self.assertRaises(TypeError): + is_positive(False) + + def test_complex_number_input(self): + """It should raise TypeError for complex number input.""" + with self.assertRaises(TypeError): + is_positive(1 + 2j) + + +if __name__ == "__main__": + unittest.main() diff --git a/solutions/tests/test_longest_word.py b/solutions/tests/test_longest_word.py new file mode 100644 index 000000000..45bc47ace --- /dev/null +++ b/solutions/tests/test_longest_word.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + + +""" +This module contains unit tests for the `longest_word` function. + +The tests verify that the `longest_word` function works as expected for a variety of +valid and invalid inputs, including boundary cases. + +Tests include: +- Valid sentence inputs containing multiple words. +- Sentences with a single word. +- Empty strings to test for error handling. +- Non-string inputs to ensure a `ValueError` is raised. +- Sentences with multiple longest words to check if the first encountered word is returned. + +The tests ensure that the function returns the correct longest word, and that it raises an +`AssertionError` when given invalid inputs such as non-string values or empty strings. +""" + +import unittest +from solutions.longest_word import longest_word + + +class TestLongestWord(unittest.TestCase): + """ + Test the behavior of the longest_word function. + """ + + def test_sentence_with_punctuation(self): + """ + Test case for sentences containing punctuation. + The function should return the longest word, ignoring punctuation. + """ + result = longest_word("Hello, world!") + self.assertEqual(result, "Hello") + + def test_non_string_input(self): + """ + Test case for non-string input to ensure defensive assertion raises the error. + """ + with self.assertRaises(AssertionError): + longest_word(123) # Pass a non-string value + + def test_empty_string(self): + """ + Test case for an empty string to ensure the correct error is raised. + """ + with self.assertRaises(AssertionError): + longest_word("") # Pass an empty string + + def test_single_word(self): + """ + Test case for a sentence with a single word. + The function should return the single word. + """ + result = longest_word("Python") + self.assertEqual(result, "Python") + + def test_multiple_longest_words(self): + """ + Test case for multiple words of the same maximum length. + The function should return the first encountered word. + """ + result = longest_word("apple banana cherry") + self.assertEqual(result, "banana") + + +if __name__ == "__main__": + unittest.main()