-
-
Notifications
You must be signed in to change notification settings - Fork 42
London| SDC-N0v-25| Ikenna Agulobi | Sprint 5| Laptop allocation #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
OracPrime
left a comment
There was a problem hiding this 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 | |||
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)): |
There was a problem hiding this comment.
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?
Learners, PR Template
Self checklist
Changelist
This PR contains the Laptop allocation exercise of sprint 5