Skip to content

Conversation

@ike-agu
Copy link

@ike-agu ike-agu commented Dec 29, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

This PR contains the Laptop allocation exercise of sprint 5

@ike-agu ike-agu added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 29, 2025
@OracPrime OracPrime added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 11, 2026
Copy link

@OracPrime OracPrime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is generally very good and has some nice touches in terms of normalization etc. However your algorithm doesn't scale. Can you think of a "good enough" rather than perfect one that does scale?

@@ -0,0 +1,104 @@
from dataclasses import dataclass
from enum import Enum
from typing import List, Dict, Optional, Tuple

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you started using a Tuple and changed it to a List? It's good practice to remove unwanted imports.


# =====define parse operating system======
def parse_operating_system(raw: str) -> OperatingSystem:
normalized = raw.strip().lower()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!


if normalized not in aliases:
valid = ", ".join(sorted(aliases.keys()))
print(f"Error: invalid operating system. Try one of: {valid}", file=sys.stderr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the inclusion of allowed values in the error message. Like the fact that you're using stderr

best_assignment: Optional[Dict[Person, Laptop]] = None
best_total_sadness: Optional[int] = None

for chosen_laptops in itertools.combinations(laptops, len(people)):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work for 5 laptops. What happens if you've got 20 laptops?

@OracPrime OracPrime added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants