Skip to content

Conversation

@sheetalkharab
Copy link

@sheetalkharab sheetalkharab commented Oct 13, 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

laptop allocation function

Questions

No

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@sheetalkharab sheetalkharab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

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

Apologies for the lateness in the review, this is a good implementation, but you might want to consider the efficiency. I've left a comment about that in the code. Can you think of any changes that could improve that?

for person in people:
# Find laptop that gives this person minimum sadness
if available_laptops:
best_laptop = min(available_laptops, key=lambda l: calculate_sadness(person, l))

Choose a reason for hiding this comment

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

This method works, one thing to be careful of is this think how often this function will run.

It will always run, for every laptop, even if the very first one were a perfect match.

It's not an issue in your example here, but imagine if we were running this with thousands of laptop and people entries

@LonMcGregor LonMcGregor 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. labels Oct 28, 2025
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