Skip to content

Commit

Permalink
Merge branch 'main' of github.com:MIT-Emerging-Talent/ET6-foundations…
Browse files Browse the repository at this point in the history
…-group-22
  • Loading branch information
TibyanKhalid committed Jan 12, 2025
2 parents 19f2854 + 9ff0f66 commit 1cde011
Show file tree
Hide file tree
Showing 22 changed files with 390 additions and 513 deletions.
Binary file added .pylintrc
Binary file not shown.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,6 @@
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
}
},
"cSpell.words": ["dcbae", "doctests", "unittests"]
}
64 changes: 59 additions & 5 deletions collaboration/retrospective.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,74 @@

## Stop Doing

### Mistakes Made

- 🕒 Time Management:
- Spending too much time organizing synchronous meetings instead of working asynchronously.
- Poor prioritization strategies and leaving most work for the last days.
- 🔄 Missed Steps:
- Lack of early starts to provide opportunities for better knowledge sharing.
- No clear process for reassigning reviews if someone was unavailable.
- The review process took longer than expected and needed better management.
- 🗨️ Communication Issues:
- Lack of asynchronous protocols like setting response times and deadlines
- Insufficient regular and short catch-up meetings.
- No specific roles defined for team members, such as a team leader for task assignment.

---

## Continue Doing

### Successes to Maintain

- 🛠️ Tools and Practices:
- Effective use of Slack for communication and GitHub project boards for organization.
- Recording meetings for those unable to attend.
- Structured code review through GitHub pull request features.
- 🤝 Supportive Culture:
- Team members were supportive, helping each other with questions or issues.
- One-on-one quick meetings scheduled to resolve individual issues.

---

## Start Doing

### New Ideas to Implement

- 📌 Create a pinned table in Slack with solutions to common errors.
- ⏳ Set deadlines for tasks to improve organization.
- 📆 Use a shared calendar for tracking task progress.
- 📝 Introduce clearly defined roles for team members, such as assigning a team
leader to oversee task assignment.

---

## Lessons Learned

______________________________________________________________________
### Key Takeaways

- Tools and Skills:
- 💻 Better understanding of GitHub features and their application in teamwork.
- 📝 Importance of constructive feedback during code reviews.
- Teamwork and Communication:
- 🔗 Asynchronous collaboration requires clear communication and coordination.
- 👀 "You can't see your mistakes until someone else points them out to you."

---

## Strategy vs. Board

### What parts of your plan went as expected?
### Successes

- 🌈 Smooth progress without conflicting opinions.
- 🧩 Effective collaboration through Slack and GitHub's code review process.

### Challenges

### What parts of your plan did not work out?
- 🕰️ Fixed meeting times were impractical due to varying paces of work.
- 🛑 Progress delays caused by task dependencies.

### Did you need to add things that weren't in your strategy?
### Adjustments

### Or remove extra steps?
- 💡 Encourage sharing of bug fixes or solutions on Slack.
- 🕒 Schedule quick weekly meetings to track progress.
36 changes: 36 additions & 0 deletions solutions/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
# Solutions

This folder contains implementations for the challenges.

## Challenges

1. **Merge Dictionaries**:
- A utility to merge two dictionaries with conflict resolution.
- See `merge_dictionaries.py` for the implementation.

2. **Anagram Finder**:
- A function to check if two strings are anagrams.
- See `anagram_finder.py` for the implementation.

## Usage

To use any solution, simply import the
required function and pass the appropriate arguments.

### How to Run

1. Clone the repository.
2. Navigate to the folder containing the solution.
3. Run the desired script:

```bash
python <script_name>.py
```

### Example

```python
# Example for Anagram Finder
from anagram_finder import are_anagrams
result = are_anagrams("listen", "silent")
print(result) # Output: True
1 change: 0 additions & 1 deletion solutions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

44 changes: 0 additions & 44 deletions solutions/calculate_square_area.py

This file was deleted.

56 changes: 56 additions & 0 deletions solutions/check_number_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This function asks the user to enter a number and checks if the number
is even or odd. It then returns the result as a string.
Created on 05 01 2025
@author: Eman Alfalouji.
"""


def check_number_type(user_input: str) -> str:
"""
The function asks the user to enter a number and determines if it is type (even or odd.)
Parameters:
user_input (str): str
A string that represents an integer.
Floats or non-integer formats are not allowed.
Raises:
ValueError: If the input is empty.
ValueError: If the input is not a valid integer.
Returns:
results will be a text whether "The number is even", "The number is odd"
or raises an appropriate error.
Examples :
>>> check_number_type("20")
"The number is even"
>>> check_number_type("11")
"The number is odd"
>>> check_number_type("-11")
"The number is odd"
>>> check_number_type("")
Traceback (most recent call last):
...
ValueError:"Input cannot be empty. Enter a valid number."
>>> check_number_type("Eman")
Traceback (most recent call last):
...
ValueError:"Please enter a valid number"
"""
user_input = user_input.strip()
# Check if it is empty
if not user_input:
raise ValueError("Input cannot be empty. Enter a valid number.")
# check if it is a number
if not user_input.lstrip("-").isdigit():
raise ValueError("Please enter a valid number")
number = int(user_input)
# Check if the number is even or odd
if number % 2 == 0:
return "The number is even"
else:
return "The number is odd"
47 changes: 0 additions & 47 deletions solutions/convert_hours_to_minutes.py

This file was deleted.

77 changes: 77 additions & 0 deletions solutions/get_unique_values.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module provides functionality to extract unique values from a CSV file.
Author: Derek Karungani
Date Created: 2024-12-11
"""

import csv


def get_unique_values(file_path: str, column_name: str) -> list:
"""
Get unique values from a specified column in a CSV file.
Parameters:
file_path (str): Path to the CSV file. It should be a valid path to an existing CSV file.
The function assumes the file is encoded in UTF-8. Both relative and absolute
paths are acceptable. The file must exist, or a FileNotFoundError will be raised.
column_name (str): Name of the column to extract unique values. It should correspond to a
header in the CSV file.
Returns:
list: Unique values in the specified column. The order of the unique values is not guaranteed to be
the same as their order of appearance in the CSV file.
Raises:
FileNotFoundError: If the file path is invalid or the file does not exist.
KeyError: If the column name doesn't exist in the CSV.
ValueError: If the `file_path` is an empty string.
Examples:
>>> with open("test.csv", "w", newline="") as f:
... writer = csv.writer(f)
... writer.writerow(["Name", "Age", "City"])
... writer.writerow(["Alice", "25", "New York"])
... writer.writerow(["Bob", "30", "London"])
... writer.writerow(["Alice", "25", "Paris"])
>>> get_unique_values("test.csv", "Name")
['Bob', 'Alice']
>>> get_unique_values("test.csv", "City")
['Paris', 'New York', 'London']
>>> get_unique_values("test.csv", "Age")
['30', '25']
>>> get_unique_values("test.csv", "Country")
Traceback (most recent call last):
...
KeyError: "Column 'Country' does not exist in the CSV."
>>> get_unique_values("nonexistent_file.csv", "Name")
Traceback (most recent call last):
... FileNotFoundError: File not found: nonexistent_file.csv
>>> get_unique_values("", "Name")
Traceback (most recent call last):
...
ValueError: The file_path cannot be an empty string.
"""
# Check for empty file_path
if not file_path:
raise ValueError("The file_path cannot be an empty string.")
# Try to open the file and read data
try:
with open(file_path, "r", encoding="utf-8") as file:
reader = csv.DictReader(file)
# Check if the column name exists in the CSV header
if column_name not in reader.fieldnames:
raise KeyError(f"Column '{column_name}' does not exist in the CSV.")

unique_values = set()
# Iterate through the rows and add unique values to the set
for row in reader:
unique_values.add(row[column_name])

return list(unique_values)
# Handle file not found error
except FileNotFoundError as e:
raise FileNotFoundError(f"File not found: {file_path}") from e
42 changes: 0 additions & 42 deletions solutions/is_palindrome.py

This file was deleted.

Loading

0 comments on commit 1cde011

Please sign in to comment.