From ea58ca6e49dbc54543d6119c394b16a645692117 Mon Sep 17 00:00:00 2001 From: Faisal Minawi Date: Tue, 7 Jan 2025 21:41:44 +0200 Subject: [PATCH 01/19] Add is_positive function with unit tests - Implement is_positive function to check if a number is positive - Add comprehensive unit tests covering standard cases, edge cases, and defensive tests - Include documentation and docstrings --- solutions/is_positive.py | 45 ++++++++++++++++ solutions/tests/test_is_positive.py | 80 +++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 solutions/is_positive.py create mode 100644 solutions/tests/test_is_positive.py diff --git a/solutions/is_positive.py b/solutions/is_positive.py new file mode 100644 index 000000000..ca25cafdb --- /dev/null +++ b/solutions/is_positive.py @@ -0,0 +1,45 @@ +""" +is_positive.py +This module provides a function to determine if a given number is positive. + +Author: Faisal Minawi +Date: Mon Jan 6 2025 +Group: ET6-foundations-group-16 + +Functions: +- is_positive(n): Determines if a given number is positive (greater than 0). +""" + + +def is_positive(n): + """ + Checks if a given number is positive. + + Parameters: + - n (int or float): A number to check. + + Returns: + - bool: True if the number is greater than 0, False otherwise. + + Raises: + - TypeError: If the input is not a real number (int or float) + + Examples: + >>> is_positive(5) + True + >>> is_positive(-3) + False + >>> is_positive(0) + False + >>> is_positive(3.14) + True + >>> is_positive(-2.5) + False + >>> is_positive("5") + Traceback (most recent call last): + ... + TypeError: Input must be a real number (int or float) + """ + if not isinstance(n, (int, float)) or isinstance(n, bool): + raise TypeError("Input must be a real number (int or float)") + return n > 0 diff --git a/solutions/tests/test_is_positive.py b/solutions/tests/test_is_positive.py new file mode 100644 index 000000000..1ccda5278 --- /dev/null +++ b/solutions/tests/test_is_positive.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Test module for 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_positive_integers(self): + """It should return True for positive integers.""" + self.assertTrue(is_positive(5)) + self.assertTrue(is_positive(1)) + self.assertTrue(is_positive(100)) + + def test_negative_integers(self): + """It should return False for negative integers.""" + self.assertFalse(is_positive(-5)) + self.assertFalse(is_positive(-1)) + self.assertFalse(is_positive(-100)) + + def test_zero(self): + """It should return False for zero.""" + self.assertFalse(is_positive(0)) + + # Edge cases + def test_large_numbers(self): + """It should handle very large numbers correctly.""" + self.assertTrue(is_positive(1e308)) + self.assertFalse(is_positive(-1e308)) + + def test_small_numbers(self): + """It should handle very small positive and negative numbers correctly.""" + self.assertTrue(is_positive(1e-308)) + self.assertFalse(is_positive(-1e-308)) + + def test_floating_points(self): + """It should handle floating point numbers correctly.""" + self.assertTrue(is_positive(0.1)) + self.assertTrue(is_positive(3.14)) + self.assertFalse(is_positive(-0.1)) + self.assertFalse(is_positive(-3.14)) + + # Defensive tests + def test_invalid_input_type_string(self): + """It should raise TypeError for string inputs.""" + with self.assertRaises(TypeError): + is_positive("5") + + def test_invalid_input_type_none(self): + """It should raise TypeError for None input.""" + with self.assertRaises(TypeError): + is_positive(None) + + def test_invalid_input_type_bool(self): + """It should raise TypeError for boolean inputs.""" + with self.assertRaises(TypeError): + is_positive(True) + with self.assertRaises(TypeError): + is_positive(False) + + def test_complex_numbers(self): + """It should raise TypeError for complex numbers.""" + with self.assertRaises(TypeError): + is_positive(1 + 2j) + + +if __name__ == "__main__": + unittest.main() From bd201161c7998d42d11a0479f6264c635265c376 Mon Sep 17 00:00:00 2001 From: RandomProjects-db Date: Sun, 12 Jan 2025 14:25:16 +0200 Subject: [PATCH 02/19] read me update in solutions --- solutions/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/solutions/README.md b/solutions/README.md index 2ff7d897d..b6129a27e 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -24,10 +24,11 @@ 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| +| `kronecker_product.py` | Computes the Kronecker โŠ— product of 2 matrices | 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| From 826104a37e057477cd84e8f1d9495ce69d82120c Mon Sep 17 00:00:00 2001 From: Razan Date: Sun, 12 Jan 2025 16:14:23 +0200 Subject: [PATCH 03/19] This is the project retrospective --- collaboration/retrospective.md | 155 ++++++++++++++++++++++++++++++--- 1 file changed, 144 insertions(+), 11 deletions(-) diff --git a/collaboration/retrospective.md b/collaboration/retrospective.md index 74e18813b..d8b465eb0 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 ๐Ÿ† + +- Achieved a significant milestone of making +over **300 commits in less than two weeks**. +- Gained valuable experience in group collaboration, enhancing +understanding of teamwork and workflow management. +- Acquired skills in using GitHub, VS Code, and conducting code reviews. + +--- + +## 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. +- Communication barriers, including difficulties conveying desired code +changes 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. From afef945dfaed073c4f4059ba9d0914585fdc2a89 Mon Sep 17 00:00:00 2001 From: Faisal Minawi Date: Sun, 12 Jan 2025 18:14:29 +0200 Subject: [PATCH 04/19] Address PR feedback: - Improve boolean input handling - Fix test cases notation and syntax - Split tests into more granular cases - Improve test documentation and naming --- solutions/is_positive.py | 37 +++++++++-------- solutions/tests/test_is_positive.py | 62 +++++++++++++++++++---------- 2 files changed, 61 insertions(+), 38 deletions(-) diff --git a/solutions/is_positive.py b/solutions/is_positive.py index ca25cafdb..334b7d779 100644 --- a/solutions/is_positive.py +++ b/solutions/is_positive.py @@ -1,28 +1,29 @@ +#!/usr/bin/env python3 + """ -is_positive.py -This module provides a function to determine if a given number is positive. +A module for checking if a number is positive. -Author: Faisal Minawi -Date: Mon Jan 6 2025 -Group: ET6-foundations-group-16 +Module contents: +- is_positive: Determines if a given number is positive. -Functions: -- is_positive(n): Determines if a given number is positive (greater than 0). +Author: Faisal Minawi +Created: 2025-01-08 """ -def is_positive(n): - """ - Checks if a given number is positive. +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 (int or float): A number to check. + n: float or int, the number to check. Returns: - - bool: True if the number is greater than 0, False otherwise. - - Raises: - - TypeError: If the input is not a real number (int or float) + bool: True if the number is greater than 0, False otherwise. Examples: >>> is_positive(5) @@ -35,11 +36,13 @@ def is_positive(n): True >>> is_positive(-2.5) False - >>> is_positive("5") + >>> is_positive(True) Traceback (most recent call last): ... TypeError: Input must be a real number (int or float) """ - if not isinstance(n, (int, float)) or isinstance(n, bool): + 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/tests/test_is_positive.py b/solutions/tests/test_is_positive.py index 1ccda5278..b60257d6f 100644 --- a/solutions/tests/test_is_positive.py +++ b/solutions/tests/test_is_positive.py @@ -3,6 +3,9 @@ """ 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 @@ -18,60 +21,77 @@ class TestIsPositive(unittest.TestCase): """Test suite for the is_positive function.""" # Standard test cases - def test_positive_integers(self): - """It should return True for positive integers.""" + def test_basic_positive_integer(self): + """It should return True for basic positive integer.""" self.assertTrue(is_positive(5)) - self.assertTrue(is_positive(1)) - self.assertTrue(is_positive(100)) - def test_negative_integers(self): - """It should return False for negative integers.""" + def test_basic_negative_integer(self): + """It should return False for basic negative integer.""" self.assertFalse(is_positive(-5)) - self.assertFalse(is_positive(-1)) - self.assertFalse(is_positive(-100)) + + 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_large_numbers(self): - """It should handle very large numbers correctly.""" + 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_small_numbers(self): - """It should handle very small positive and negative numbers correctly.""" + 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)) - def test_floating_points(self): - """It should handle floating point numbers correctly.""" + # 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_invalid_input_type_string(self): - """It should raise TypeError for string inputs.""" + def test_string_input(self): + """It should raise TypeError for string input.""" with self.assertRaises(TypeError): is_positive("5") - def test_invalid_input_type_none(self): + def test_none_input(self): """It should raise TypeError for None input.""" with self.assertRaises(TypeError): is_positive(None) - def test_invalid_input_type_bool(self): - """It should raise TypeError for boolean inputs.""" + 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_numbers(self): - """It should raise TypeError for complex numbers.""" + def test_complex_number_input(self): + """It should raise TypeError for complex number input.""" with self.assertRaises(TypeError): is_positive(1 + 2j) From 8a33ceb7fec630d4b1512e7d7cb9b8cbb7b0a1f7 Mon Sep 17 00:00:00 2001 From: RandomProjects-db Date: Sun, 12 Jan 2025 19:27:20 +0200 Subject: [PATCH 05/19] new challenge GCD --- solutions/README.md | 1 + solutions/gcd.py | 54 +++++++++++++++++++++++ solutions/tests/test_gcd.py | 85 +++++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 solutions/gcd.py create mode 100644 solutions/tests/test_gcd.py diff --git a/solutions/README.md b/solutions/README.md index b6129a27e..b4b93e3c5 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -25,6 +25,7 @@ while corresponding test files are maintained in the `tests` folder. | `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| | `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 | 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/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() From ad9e284ada0df0d8130efde3bebb649897181ebe Mon Sep 17 00:00:00 2001 From: Faisal Minawi Date: Sun, 12 Jan 2025 19:52:33 +0200 Subject: [PATCH 06/19] Fix code formatting according to ruff standards --- solutions/grading_system.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solutions/grading_system.py b/solutions/grading_system.py index 4335e5fa2..fc9e4148a 100644 --- a/solutions/grading_system.py +++ b/solutions/grading_system.py @@ -44,9 +44,9 @@ def grading_system(score: int | float) -> str: """ - assert isinstance( - score, (int, float) - ), "The score is neither an integer nor a float." + assert isinstance(score, (int, float)), ( + "The score is neither an integer nor a float." + ) assert score >= 0, "Score is less than 0" assert score <= 100, "Score is greater than 100" From 2a5d9e245c58165b9834148b3a72b102161151e6 Mon Sep 17 00:00:00 2001 From: RandomProjects-db Date: Sun, 12 Jan 2025 19:56:37 +0200 Subject: [PATCH 07/19] new challenge Fibonacci --- solutions/fibonacci.py | 58 +++++++++++++++++++++++ solutions/tests/test_fibonacci.py | 79 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 solutions/fibonacci.py create mode 100644 solutions/tests/test_fibonacci.py diff --git a/solutions/fibonacci.py b/solutions/fibonacci.py new file mode 100644 index 000000000..f335ea9dc --- /dev/null +++ b/solutions/fibonacci.py @@ -0,0 +1,58 @@ +# !/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +fibonacci.py + +This module provides a function to generate the Fibonacci sequence up to the given number of 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 +Date: Jan 12 2025 +Group: ET6-foundations-group-16 +""" + + +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/tests/test_fibonacci.py b/solutions/tests/test_fibonacci.py new file mode 100644 index 000000000..6593b3657 --- /dev/null +++ b/solutions/tests/test_fibonacci.py @@ -0,0 +1,79 @@ +# !/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() From 87a1d08ea0661e05d239ed2b22f2fe7ff942f028 Mon Sep 17 00:00:00 2001 From: RandomProjects-db Date: Sun, 12 Jan 2025 20:22:33 +0200 Subject: [PATCH 08/19] after review edit -new challenge Fibonacci --- solutions/fibonacci.py | 2 +- solutions/tests/test_fibonacci.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/solutions/fibonacci.py b/solutions/fibonacci.py index f335ea9dc..9f70d6688 100644 --- a/solutions/fibonacci.py +++ b/solutions/fibonacci.py @@ -1,4 +1,4 @@ -# !/usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/solutions/tests/test_fibonacci.py b/solutions/tests/test_fibonacci.py index 6593b3657..7337cabc9 100644 --- a/solutions/tests/test_fibonacci.py +++ b/solutions/tests/test_fibonacci.py @@ -1,4 +1,4 @@ -# !/usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @@ -18,6 +18,7 @@ """ import unittest + from solutions.fibonacci import generate_fibonacci From d49da7401bbf65846ee099aed0fd50bd2dca0eef Mon Sep 17 00:00:00 2001 From: FaisalMinawi <113420467+FaisalMinawi@users.noreply.github.com> Date: Sun, 12 Jan 2025 20:25:20 +0200 Subject: [PATCH 09/19] Update README.md Included Faisal Minawi's work --- solutions/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/solutions/README.md b/solutions/README.md index b6129a27e..dd04d3d6b 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -42,6 +42,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 if a string is a palindrome ignoring case and special characters | Faisal | --- From b7901796227f626ab8587fd5c75ac322e4d9a611 Mon Sep 17 00:00:00 2001 From: RandomProjects-db Date: Sun, 12 Jan 2025 20:27:36 +0200 Subject: [PATCH 10/19] after review edit -new challenge Fibonacci --- solutions/fibonacci.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/solutions/fibonacci.py b/solutions/fibonacci.py index 9f70d6688..2ba05dce9 100644 --- a/solutions/fibonacci.py +++ b/solutions/fibonacci.py @@ -2,16 +2,16 @@ # -*- coding: utf-8 -*- """ -fibonacci.py +A module for generating Fibonacci sequences. -This module provides a function to generate the Fibonacci sequence up to the given number of 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. +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 -Date: Jan 12 2025 -Group: ET6-foundations-group-16 +Created: 12-Jan-2025 """ From 8fab3630fa97fe20901f9148a4f788243266dcda Mon Sep 17 00:00:00 2001 From: FaisalMinawi <113420467+FaisalMinawi@users.noreply.github.com> Date: Sun, 12 Jan 2025 20:39:20 +0200 Subject: [PATCH 11/19] Update README.md --- solutions/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/README.md b/solutions/README.md index dd04d3d6b..edd71c12a 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -43,7 +43,7 @@ while corresponding test files are maintained in the `tests` folder. | `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 if a string is a palindrome ignoring case and special characters | Faisal | +| `is_palindrome.py` | Checks string palindrome properties | Faisal | --- From e46e20d506f48feaed64b2d88a8c4c360ac3d3ff Mon Sep 17 00:00:00 2001 From: RandomProjects-db Date: Sun, 12 Jan 2025 20:40:06 +0200 Subject: [PATCH 12/19] edits for readme in gcd --- solutions/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/solutions/README.md b/solutions/README.md index b4b93e3c5..612620b67 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -27,6 +27,7 @@ while corresponding test files are maintained in the `tests` folder. | `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 | From e6434f01a72ae9cd1db3d4557138d9b063be37e3 Mon Sep 17 00:00:00 2001 From: Mo-Altayeb Date: Sun, 12 Jan 2025 20:51:42 +0200 Subject: [PATCH 13/19] add solution to Count Character challenge and updated README --- solutions/README.md | 1 + solutions/count_character.py | 49 ++++++++++++++++++++++ solutions/tests/test_count_character.py | 56 +++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 solutions/count_character.py create mode 100644 solutions/tests/test_count_character.py diff --git a/solutions/README.md b/solutions/README.md index b6129a27e..8d01f2910 100644 --- a/solutions/README.md +++ b/solutions/README.md @@ -42,6 +42,7 @@ 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 | +| `count_character.py`| counts occurrences of a character in a string| Mohamed| --- diff --git a/solutions/count_character.py b/solutions/count_character.py new file mode 100644 index 000000000..415440a85 --- /dev/null +++ b/solutions/count_character.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +A module for counting occurrences of a character in a string. + +Created on 12/1/2025 +@author: Mohamed Altayeb +Group: ET foundations group 16 (Matrix) + +Module functions: + - count_character: counts occurrences of a character in a string. + +""" + + +def count_character(input_string: str, character: str): + """ + Counts the number of occurrences of a specific character in a string + It will treat capital letters as different characters compared to small letters. + + Arguments: + input_string (str): The string to count in. + character (str): The character to count. + + Returns: + int: The number of occurrences of the character in the string. + + Raises: + AssertionError: if input string is not a string or character is not a single + character string. + + >>> count_character("Mohamed", "m") + 1 + + >>> count_character("test", "l") + 0 + + >>> count_character("mississippi", "s") + 4 + + """ + # Make sure inputs are correct + if not isinstance(input_string, str): + raise AssertionError("The input_string must be a string.") + if not isinstance(character, str) or len(character) != 1: + raise AssertionError("The character must be a single character string.") + + # Return the number of occurrences of character in the string + return input_string.count(character) diff --git a/solutions/tests/test_count_character.py b/solutions/tests/test_count_character.py new file mode 100644 index 000000000..474ed4201 --- /dev/null +++ b/solutions/tests/test_count_character.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Test module for count_character function + +Created on 11/1/2025 +@author: Mohamed Altayeb +Group: ET foundations group 16 (Matrix) +""" + +import unittest + +from ..count_character import count_character + + +class TestCountCharacter(unittest.TestCase): + """Test suite for the count_character function""" + + def test_string_with_no_occurrence(self): + """it should return zero when the character is not in the string""" + self.assertEqual(count_character("abcdefg", "h"), 0) + + def test_empty_string(self): + """it should return zero when the input string is empty""" + self.assertEqual(count_character("", "h"), 0) + + def test_string_with_normal_occurrence(self): + """it should return the number of occurrences when the character in the string""" + self.assertEqual(count_character("looking for a char", "o"), 3) + + def test_string_with_capital_and_small_letters(self): + """it should treat capital letters as different characters compared to their small + counterparts""" + self.assertEqual(count_character("Mohammed Made soMething", "M"), 3) + + def test_counting_spaces(self): + """it should count the number of spaces in a string when passed a space as + a character""" + self.assertEqual( + count_character("there are a l ot of spaces i n this l ine", " "), 13 + ) + + def test_input1_is_not_a_string(self): + """It should raise AssertionError if first input is not a string""" + with self.assertRaises(AssertionError): + count_character(["mohamed"], "m") + + def test_character_is_not_a_string(self): + """It should raise AssertionError if first input is not a single character string""" + with self.assertRaises(AssertionError): + count_character(["mohamed"], 2) + + def test_length_of_character_is_not_one(self): + """It should raise AssertionError if length of character is not one""" + with self.assertRaises(AssertionError): + count_character(["mohamed"], "med") From 0e5a00aa450f43221cb4e1e2e138c124bcc1c0d8 Mon Sep 17 00:00:00 2001 From: Fahed Daibes <61588630+RandomProjects-db@users.noreply.github.com> Date: Sun, 12 Jan 2025 21:27:51 +0200 Subject: [PATCH 14/19] Revert "Add is_positive function with unit tests" --- solutions/is_positive.py | 48 ------------- solutions/tests/test_is_positive.py | 100 ---------------------------- 2 files changed, 148 deletions(-) delete mode 100644 solutions/is_positive.py delete mode 100644 solutions/tests/test_is_positive.py diff --git a/solutions/is_positive.py b/solutions/is_positive.py deleted file mode 100644 index 334b7d779..000000000 --- a/solutions/is_positive.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/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: Faisal Minawi -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 - >>> is_positive(True) - Traceback (most recent call last): - ... - TypeError: Input must be a real number (int or float) - """ - 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/tests/test_is_positive.py b/solutions/tests/test_is_positive.py deleted file mode 100644 index b60257d6f..000000000 --- a/solutions/tests/test_is_positive.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/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() From a6eaadf08fb2fa236876648627bdc597b920d509 Mon Sep 17 00:00:00 2001 From: Faisal Minawi Date: Sun, 12 Jan 2025 21:48:26 +0200 Subject: [PATCH 15/19] Add is_positive function with unit tests - Implement is_positive function to check if a number is positive - Add comprehensive unit tests covering standard cases, edge cases, and defensive tests - Include documentation and docstrings --- solutions/is_positive.py | 44 ++++++++++++ solutions/tests/test_is_positive.py | 100 ++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 solutions/is_positive.py create mode 100644 solutions/tests/test_is_positive.py 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/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() From a227618d4030acbfe5f67cf197204ceca38f4399 Mon Sep 17 00:00:00 2001 From: Razan Date: Sun, 12 Jan 2025 22:27:13 +0200 Subject: [PATCH 16/19] Modify some points in the retrospective file --- collaboration/retrospective.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/collaboration/retrospective.md b/collaboration/retrospective.md index d8b465eb0..4c533905d 100644 --- a/collaboration/retrospective.md +++ b/collaboration/retrospective.md @@ -31,11 +31,11 @@ ensuring clarity on priorities and reducing misunderstandings. ### 2. Achievements ๐Ÿ† -- Achieved a significant milestone of making -over **300 commits in less than two weeks**. -- Gained valuable experience in group collaboration, enhancing -understanding of teamwork and workflow management. -- Acquired skills in using GitHub, VS Code, and conducting code reviews. +**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. --- @@ -87,8 +87,8 @@ available simultaneously, causing occasional delays. - 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. -- Communication barriers, including difficulties conveying desired code -changes due to language differences. +- 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. --- From d1ef4f880080f74520400ab4e388225749ad19c5 Mon Sep 17 00:00:00 2001 From: ObayCipher Date: Sun, 12 Jan 2025 21:28:12 +0100 Subject: [PATCH 17/19] fix codes files --- solutions/direction_to_degree.py | 2 ++ solutions/feet_to_meters.py | 1 + solutions/miles_to_kilometers.py | 2 ++ solutions/volts_to_amperes.py | 1 + 4 files changed, 6 insertions(+) diff --git a/solutions/direction_to_degree.py b/solutions/direction_to_degree.py index f563914d3..b567d90eb 100644 --- a/solutions/direction_to_degree.py +++ b/solutions/direction_to_degree.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- """ direction_to_degree.py diff --git a/solutions/feet_to_meters.py b/solutions/feet_to_meters.py index 7c14cb2ea..4f00d7097 100644 --- a/solutions/feet_to_meters.py +++ b/solutions/feet_to_meters.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# -*- coding: utf-8 -*- """ Module to convert feet to meters. diff --git a/solutions/miles_to_kilometers.py b/solutions/miles_to_kilometers.py index 88cfc5045..0b4f6bc84 100644 --- a/solutions/miles_to_kilometers.py +++ b/solutions/miles_to_kilometers.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- """ miles_to_kilometers.py diff --git a/solutions/volts_to_amperes.py b/solutions/volts_to_amperes.py index 059a4b615..b8ed6eecb 100644 --- a/solutions/volts_to_amperes.py +++ b/solutions/volts_to_amperes.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# -*- coding: utf-8 -*- """ This module contains a function to convert voltage to amperes using Ohm's law. The formula used is: I = V / R From e6fe2b1ca88842bc3025e58053ceecc8b60ab31e Mon Sep 17 00:00:00 2001 From: Razan Date: Sun, 12 Jan 2025 23:19:20 +0200 Subject: [PATCH 18/19] Adding my learning resources --- notes/README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/notes/README.md b/notes/README.md index 558db9254..2ac8d8921 100644 --- a/notes/README.md +++ b/notes/README.md @@ -5,18 +5,18 @@ Welcome to the **Notes** directory! ๐ŸŽ‰ This is our little corner of the project where we share all the gems we pick up along the way. ๐Ÿง โœจ -Hereโ€™s what youโ€™ll find (and what youโ€™re welcome to add): +Hereโ€™s what youโ€™ll find (and what youโ€™re welcome to add): - ๐Ÿ–‹๏ธ **What We're Learning:** Got a cool trick in Git? Learned a new design -pattern? Found a clever way to squash bugs? Share it here! +pattern? Found a clever way to squash bugs? Share it here! - ๐Ÿ˜‚ **Funny Moments:** Code reviews arenโ€™t always serious โ€” if something made you laugh (or cry), jot it down! Laughter is the best debugging tool. - ๐Ÿ“š **Resources:** Found a great article, video, or book that helped you level up? Share it with the team! - โค๏ธ **Personal Reflections:** Howโ€™s the journey been for you? Whether itโ€™s -growth, challenges, or proud moments, weโ€™d love to hear about it. +growth, challenges, or proud moments, weโ€™d love to hear about it. - ๐Ÿค **Collaboration Stories:** Cool ways weโ€™ve helped each other shine or -overcame hurdles as a team. +overcame hurdles as a team. - ๐ŸŽจ **Creative Additions:** Doodles, memes, or anything that adds color to our shared experience! @@ -25,3 +25,12 @@ your learning, share your quirks, or just have fun. Letโ€™s make this a treasure trove of memories and insights! ๐Ÿš€ Happy noting, team! ๐Ÿ“๐ŸŒŸ + +--- + +_**Razan Ibrahim**_ +I primarily utilized the CS sessions from the MIT Emerging Talent Program, +Cohort 6 ๐Ÿ“šโœจ, along with +a [short playlist](https://drive.google.com/drive/folders/1LiY4mKB1Vv4FRcS3J2ROHuHgqan1CWd4) +created by our teammate Clement ๐ŸŽฅ๐Ÿ™Œ. Additionally, I sought help and support +from the team ๐Ÿค๐Ÿ’ก to effectively tackle this project. From 0ff25304c945a5f7871e601b48f521ec2c7431b7 Mon Sep 17 00:00:00 2001 From: Mohamed Altayeb Date: Mon, 13 Jan 2025 00:15:32 +0200 Subject: [PATCH 19/19] Update solutions/count_character.py Co-authored-by: Obay Salih --- solutions/count_character.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/count_character.py b/solutions/count_character.py index 415440a85..45d93f78e 100644 --- a/solutions/count_character.py +++ b/solutions/count_character.py @@ -13,7 +13,7 @@ """ -def count_character(input_string: str, character: str): +def count_character(input_string: str, character: str) -> int: """ Counts the number of occurrences of a specific character in a string It will treat capital letters as different characters compared to small letters.