-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: reorganize parking system solution to new structure #88
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Tags: Design, Simulation, Counting | ||
| class ParkingSystem: | ||
|
|
||
| def __init__(self, big: int, medium: int, small: int): | ||
| self.spaces = {1: big, | ||
| 2: medium, | ||
| 3: small} | ||
|
|
||
| def add_car(self, car_type: int) -> bool: | ||
| if self.spaces[car_type] == 0: | ||
| return False | ||
| self.spaces[car_type] -= 1 | ||
| return True | ||
|
Comment on lines
+9
to
+13
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||||||||||
| from .solution import ParkingSystem | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| class TestSolution: | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+2
to
+5
|
||||||||||||||
| class TestSolution: | |
| from tests.base_test import BaseTestSolution | |
| class TestSolution(BaseTestSolution): |
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 dictionary formatting is inconsistent with PEP 8 style for multiline dictionaries. When a dictionary is split across multiple lines, each key-value pair should be on its own line with consistent indentation, or the opening brace should be followed by a newline. Consider formatting as either:
self.spaces = {1: big, 2: medium, 3: small}(single line) or with proper alignment: