Skip to content

Commit

Permalink
Merge branch 'main' into fevzi_palindrome_checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahablotfi authored Jan 13, 2025
2 parents d0ee4d8 + a08a291 commit 49461a2
Show file tree
Hide file tree
Showing 17 changed files with 989 additions and 13 deletions.
94 changes: 83 additions & 11 deletions collaboration/retrospective.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,95 @@
<!-- this template is for inspiration, feel free to change it however you like! -->

# Retrospective

## Stop Doing
This document reflects on the successes, challenges, and lessons learned during the
**Team Code Review Project**.

---

## What Went Well

1. **Effective Communication**
- Regular updates and support through Slack helped foster a collaborative and supportive environment.
- Open communication allowed team members to share challenges and solutions effectively.

2. **Teamwork and Mutual supportip**
- Members actively supported each other, contributing to a positive learning environment.
- Troubleshooting challenges as a team became one of our best practices.

3. **Workflow and Task Management**
- The project board provided a high-level view of tasks and responsibilities, helping active members track progress and stay organized.
- The group followed the planned workflow and met the overall project deadline despite some internal delays.

## Continue Doing
4. **Clean Code Practices**
- Team members wrote clean, readable code, aligning with the goals of effective communication through written code.
- Code reviews highlighted opportunities for improvement, further enhancing code quality.

## Start Doing
---

## What Could Be Improved

1. **Procrastination**
- Some tasks were left until the last moment, creating unnecessary pressure and delays.
- Push-related challenges and issues took longer than expected to resolve, impacting group timelines.

2. **Engagement**
- Not all team members were consistently active, resulting in uneven distribution of workload.
- More effort is needed to encourage and engage inactive members to contribute to the project.

3. **Unforeseen Challenges**
- Issues with the extension update (Ruff) and unexpected technical challenges consumed additional time.
- Assumptions about group-wide familiarity with tools like Git and Python slowed down certain workflows.

---

## Lessons Learned

______________________________________________________________________
- **Communication is Key**:
Consistent and open communication between team members was critical for overcoming challenges and maintaining morale.
- **Team Troubleshooting Works**:
Collaborating on problem-solving not only sped up issue resolution but also helped everyone learn new skills.
- **Clean Code Matters**:
Writing clear and easy-to-read code significantly improved understanding during reviews and handoffs.
- **Adaptability Is Crucial**:
Challenges like the Ruff extension update reminded us to remain adaptable and willing
to consult wider community and documentation when needed.

---

## Actionable Recommendations

### What We Should Stop Doing

- **Procrastination**: Start addressing tasks earlier in the workflow to prevent last-minute bottlenecks.

### What We Should Continue Doing

- **Support and Mentorship**: Maintain a collaborative and supportive environment via Slack.
- **Open Communication**: Keep the Slack channel active for daily check-ins and updates.

### What We Should Start Doing

- **Regular Sync-Up Meetings**: Incorporate more frequent team meetings to check progress and align on tasks.
- **Encourage Engagement**: Actively engage and support less active team members to ensure an equitable distribution of workload.
- **Work-Life Balance**: Focus on balancing project work with personal commitments to avoid burnout.

---

## Reflections on Strategy

### What Worked

- The workflow on the project board provided clarity on task progress and ownership.
- Active members of the team successfully completed tasks
- within the instructor-set timeframe.

## Strategy vs. Board
### What Didn’t Work

### What parts of your plan went as expected?
- Internal deadlines were delayed due to technical challenges and inconsistent participation.
- Unexpected issues like the Ruff extension update consumed additional time and disrupted the workflow.

### What parts of your plan did not work out?
### What Needed to Be Added

### Did you need to add things that weren't in your strategy?
- Regular check-ins to monitor progress and adjust strategies in real time.
- Revisiting recorded lectures and team discussions became an unplanned but necessary part of the workflow.

### Or remove extra steps?
---
77 changes: 77 additions & 0 deletions solutions/calculate_supplier_performance_score.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
A module for calculating the performance score of a supplier.
Module contents:
- Calculates the performance score of a supplier based on delivery reliability
Created on 2025-01-07
Author: Idris Pamiri
"""

import doctest


def calculate_supplier_performance_score(
on_time_deliveries: int,
total_deliveries: int,
defective_items: int,
total_items: int,
) -> float:
"""
Evaluates supplier performance based on delivery reliability and defect rates.
The function calculates a performance score (0-100) by combining the percentage
of on-time deliveries and the percentage of defect-free items. The two metrics
are equally weighted in the score.
Parameters:
on_time_deliveries (int): Number of on-time deliveries.
total_deliveries (int): Total number of deliveries (must be greater than 0).
defective_items (int): Number of defective items.
total_items (int): Total items delivered (must be greater than 0).
Returns:
float: Supplier performance score (0-100).
Raises:
ValueError: If any input is negative or total_deliveries/total_items is zero.
Examples:
>>> calculate_supplier_performance_score(45, 50, 10, 100)
90.0
>>> calculate_supplier_performance_score(10, 10, 0, 20)
100.0
>>> calculate_supplier_performance_score(0, 10, 5, 20)
37.5
"""
# Defensive programming with assertions
assert isinstance(on_time_deliveries, int), "on_time_deliveries must be an integer"
assert isinstance(total_deliveries, int), "total_deliveries must be an integer"
assert isinstance(defective_items, int), "defective_items must be an integer"
assert isinstance(total_items, int), "total_items must be an integer"

if total_deliveries <= 0:
raise ValueError("Total deliveries must be greater than zero")
if total_items <= 0:
raise ValueError("Total items must be greater than zero")
if on_time_deliveries < 0 or defective_items < 0:
raise ValueError("on_time_deliveries and defective_items cannot be negative")
if on_time_deliveries > total_deliveries:
raise ValueError("on_time_deliveries cannot exceed total_deliveries")
if defective_items > total_items:
raise ValueError("defective_items cannot exceed total_items")

# Calculate delivery score and defect score
delivery_score = (on_time_deliveries / total_deliveries) * 100
defect_score = ((total_items - defective_items) / total_items) * 100

# Calculate overall performance score
performance_score = (delivery_score + defect_score) / 2

return performance_score


if __name__ == "__main__":
doctest.testmod()
53 changes: 53 additions & 0 deletions solutions/check_coprime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""Module to check if two numbers are relatively prime.
This module defines a function to determine whether two numbers (Integer) are relatively
prime, meaning they have no common factors than 1.
@author: Vahab
@Created: 11/01/2025
"""


def check_coprime(first_integer: int, second_integer: int) -> bool:
"""Check if two numbers are relatively prime.
Two numbers are relatively prime when there
are no common factors other than 1
Parameters:
first_integer (int): The first number (must be a positive integer).
second_integer (int): The second number (must be a positive integer).
Returns:
bool: True if the numbers are relatively prime, False otherwise.
Raises:
ValueError: If either of the inputs is not a positive integer.
TypeError: If either of the inputs is not an integer.
>>> check_coprime(15, 28)
True
>>> check_coprime(8, 12)
False
>>> check_coprime(7, 9)
True
"""

# Check if inputs are integers
if not isinstance(first_integer, int) or not isinstance(second_integer, int):
raise TypeError("Both inputs must be integers.")

# Check if inputs are positive integers
if first_integer <= 0 or second_integer <= 0:
raise ValueError("Both numbers must be positive integers.")

# Find the smaller of the two numbers
smaller = min(first_integer, second_integer)

# Check for any common factors greater than 1
for i in range(2, smaller + 1):
if first_integer % i == 0 and second_integer % i == 0:
return False

return True
52 changes: 52 additions & 0 deletions solutions/find_highest_alpha_position.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""Module for finding the highest alphabetical position in a text string.
This module provides functionality to find the alphabetical position (1-26)
of the character that appears latest in the alphabet within a given text.
@author: Musab Kaymak
@created: 01/09/2025
"""


def find_highest_alpha_position(text: str) -> int:
"""Find the alphabetical position of the latest alphabet character in text.
Parameters:
text (str): The input text to analyze. Must contain at least one letter
and only contain English letters. Numbers and special characters are ignored.
Returns:
int: The highest alphabetical position (1-26) found in the text.
'a' is position 1, 'z' is position 26.
Raises:
ValueError: If the text is empty or contains no letters.
ValueError: If the text contains non-ASCII letters.
Examples:
>>> find_highest_alpha_position("flower")
23
>>> find_highest_alpha_position("apple")
16
>>> find_highest_alpha_position("ZEBRA")
26
"""
if not text:
raise ValueError("Input text cannot be empty")

if not any(c.isalpha() for c in text):
raise ValueError("Input text must contain at least one letter")

if not all(c.isascii() for c in text):
raise ValueError("Input text must contain only English characters")

alphabet = "abcdefghijklmnopqrstuvwxyz"
max_position = 0

for char in text.lower():
if char.isalpha():
position = alphabet.index(char.lower()) + 1
if position > max_position:
max_position = position

return max_position
67 changes: 67 additions & 0 deletions solutions/fizzbuzz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""
Module resolving FizzBuzz problem according to given rules.
Module contents:
- fizzbuzz: take integer n and prints numbers from 1 to n
with the rules.
Created: 01/04/2025
Author: Svitlana Musiienko
"""


def fizzbuzz(n: int) -> list:
"""
Fizzbuz function takes an integer n as input and prints the numbers
from 1 to n with the rules:
- if a number is divisible by 3, print 'Fizz' instead of the number;
- if a number is divisible by 5, print 'Buzz' instead of the number;
- if a number is divisible by both 3 and 5, print 'FizzBuzz';
- otherwise, print the number itself.
Parameters: integer number (n)
Returns: return list of numbers from 1 to n where numbers
divisible by 3 and 5 are replaced with fizz and buzz and fizzbuzz
Raises:
AssertionError: if the argument is not integer
AssertionError: if the argument is less than 0
Example:
>>> fizzbuzz (0)
[]
>>> fizzbuzz (5)
[1, 2, 'Fizz', 4, 'Buzz']
>>> fizzbuzz(15)
[1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz']
"""
# the number should be an integer greater than 0
assert isinstance(n, int)
# the number is less than 0
assert n >= 0

result = []
# loop through numbers from 1 to n
for num in range(1, n + 1):
# check if the number is divisible by both 3 and 5
if num % 3 == 0 and num % 5 == 0:
# print "FizzBuzz" for multiples of both 3 and 5
result.append("FizzBuzz")
# check if the number is divisible by 3 only
elif num % 3 == 0:
# print "Fizz" for multiples of 3
result.append("Fizz")
# check if the number is divisible by 5 only
elif num % 5 == 0:
# print "Buzz" for multiples of 5
result.append("Buzz")
# print the number if none of the above conditions are met
else:
result.append(num)
return result
Loading

0 comments on commit 49461a2

Please sign in to comment.