Skip to content

Commit

Permalink
Merge branch 'main' into 27-binary_to_decimal_converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Khusro-S authored Jan 1, 2025
2 parents 35a0464 + e64fdb9 commit 24ad85f
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ about: A template PR for code review with a checklist
- [ ] The function's name describes it's behavior
- [ ] The function's name matches the file name
- [ ] The function has correct type annotations
- [ ] The function is not called in the function file

## Strategy

Expand Down Expand Up @@ -82,5 +83,7 @@ about: A template PR for code review with a checklist
- [ ] Variable names are clear and helpful
- [ ] The code follows the strategy as simply as possible
- [ ] The implementation is as simple as possible given the strategy
- [ ] There are no commented lines of code
- [ ] There are no `print` statements anywhere
- [ ] The code includes defensive assertions
- [ ] Defensive assertions include as little logic as possible
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": true,
"source.organizeImports.ruff": true
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
}
}
59 changes: 59 additions & 0 deletions notes/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
# Notes

## Meeting Notes and Task Assignments

### First Meeting

- **Introductions**:
- Members introduced themselves and shared their locations.
- **Discussion**:
- Assignment to practice document formatting.
- Task: Comment on a single topic — **Preparing Group Norms**.
- **Outcome**:
- Gained familiarity with document file commenting using instructions from Evan.

---

### Transition to GitHub Format

- **Reason**:
- After mastering the document file format, decided to transition to GitHub for task management and creating branches to represent specific tasks.
- **Second Meeting**:
- Discussed specific tasks and group assignments.

---

### Task Assignments and Reviews

1. **Group Norms**:
- **Task Members**: Abel and Banchiamlak
- Modified the file and pushed it to GitHub.
- **Reviewers**: Gai and Yonatan

2. **Communication File**:
- **Task Members**: Robel and Zeinab
- Prepared the file and submitted it for review.
- **Reviewers**: Viktoriya and Mohammed

3. **Learning Objectives**:
- **Task Members**: Viktoriya and Mohammed
- Prepared the file and marked it as done on the project table.
- **Reviewers**: Linah and Khusro

4. **Retrospective Task**:
- **Task Members**: Gai and Yonatan
- Waited for all other tasks to complete before preparing the file.
- **Reviewers**: Abel and Banchiamlak

---

### Post-Task Activities

- Played with other files, including the **README** file.

---

### Future Plans

- **Scheduling**:
- Plan tasks for the upcoming week.
- Prepare a **solutions schedule** for future assignments.
10 changes: 10 additions & 0 deletions notes/cheatsheets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Cheat Sheets that can help 📚

---

## These **cheat sheets** cover key topics and best practices that we might encounter in our work

- [VS Code Cheat Sheet](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf)
- [Python Cheat Sheet](https://kieranholland.com/best-python-cheat-sheet/) 🐍

### Feel free to add yours ➕📝
42 changes: 42 additions & 0 deletions solutions/sort_numbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
A module for sorting a list of numbers.
Module contents: sorted list of numbers
Created on 2024-12-30
@author: Viktoriya Haiduk
"""


def sort_numbers(numbers: list) -> list:
"""
Sorts a list of numbers.
Parameters:
numbers (list): A list of numbers to be sorted.
- May contain integers or floats.
- Must not contain non-numeric values.
Returns -> list: Sorted list of numbers in ascending order.
Raises: ValueError if the list is empty or contains non-numeric values.
Examples:
>>> sort_numbers([3, 1, 2])
[1, 2, 3]
>>> sort_numbers([4.5, 15.4, 6, 7, 2])
[2, 4.5, 6, 7, 15.4]
>>> sort_numbers([3.14159, 1.618, 2.718])
[1.618, 2.718, 3.14159]
"""
if not isinstance(numbers, list):
raise ValueError("Input must be a list.")

if not numbers:
raise ValueError("The list is empty. Please provide numbers to sort.")

if not all(isinstance(num, (int, float)) for num in numbers):
raise ValueError("The list contains non-numeric values.")

return sorted(numbers)
44 changes: 44 additions & 0 deletions solutions/tests/test_sort_numbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""
Test module for sort_numbers function.
Contains tests for testing sort_numbers function.
Created on 2024-12-30
Author: Viktoriya Haiduk
"""

import unittest

from solutions.sort_numbers import sort_numbers


class TestSortNumbers(unittest.TestCase):
def test_sorted_numbers(self):
self.assertEqual(sort_numbers([4, 1, 3, 2]), [1, 2, 3, 4])

def test_floats(self):
self.assertEqual(sort_numbers([4.5, 2.3, 1.7, 3.9]), [1.7, 2.3, 3.9, 4.5])

def test_mixed_numbers(self):
self.assertEqual(sort_numbers([4, 2.5, 3, 1.2]), [1.2, 2.5, 3, 4])

def test_invalid_input(self):
with self.assertRaises(ValueError) as context:
sort_numbers(["a", None, 3])
self.assertEqual(
str(context.exception), "The list contains non-numeric values."
)

def test_empty_list(self):
with self.assertRaises(ValueError) as context:
sort_numbers([])
self.assertEqual(
str(context.exception), "The list is empty. Please provide numbers to sort."
)

def test_negative_numbers(self):
self.assertEqual(sort_numbers([-3, -1, -4, -2]), [-4, -3, -2, -1])


if __name__ == "__main__":
unittest.main()

0 comments on commit 24ad85f

Please sign in to comment.