Skip to content

Commit e745980

Browse files
committed
passed check_abundant_laptops the user instead of just the OS
1 parent de53660 commit e745980

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎Sprint 5 Prep Exercises/exercise_11.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from enum import Enum
1414
import sys
1515

16-
# ----- Classes and Enums
16+
# ----- Classes and Enums
1717
class OperatingSystem(Enum):
1818
MACOS = "macOS"
1919
ARCH = "Arch Linux"
@@ -36,18 +36,18 @@ def count_laptops(laptops: list[Laptop], laptop_counts: dict[str, int]):
3636
for laptop in laptops:
3737
laptop_counts[laptop.operating_system] += 1
3838

39-
def check_laptop_abundance(operating_system: OperatingSystem, laptop_counts: dict[OperatingSystem, int]):
39+
def check_laptop_abundance(user: Person, laptop_counts: dict[OperatingSystem, int]):
4040
abundant_laptops = []
4141
for laptop in laptop_counts:
42-
if laptop_counts[laptop] > laptop_counts[operating_system]:
42+
if laptop_counts[laptop] > laptop_counts[user.preferred_operating_system]:
4343
abundant_laptops.append(laptop.value)
4444
if len(abundant_laptops) > 0:
4545
print("\nIf you are willing to accept another operating system you may get a laptop sooner.")
4646
print("We have more laptops available with the following OS:")
4747
for laptop in abundant_laptops:
4848
print(laptop)
4949

50-
# ----- Data and Constants
50+
# ----- Data and Constants
5151
laptops = [
5252
Laptop(id=1, operating_system=OperatingSystem.ARCH),
5353
Laptop(id=2, operating_system=OperatingSystem.ARCH),
@@ -65,7 +65,7 @@ def check_laptop_abundance(operating_system: OperatingSystem, laptop_counts: dic
6565
OperatingSystem.WINDOWS: 0
6666
}
6767

68-
# ----- Script
68+
# ----- Script
6969
user_name = input("Please enter your full name:\n")
7070
user_age_str = input("Please enter your age:\n")
7171

@@ -85,4 +85,4 @@ def check_laptop_abundance(operating_system: OperatingSystem, laptop_counts: dic
8585
count_laptops(laptops, laptop_counts)
8686
print(f"\nThe number of available laptops with {user_operating_system.value} is: {laptop_counts[user_operating_system]}")
8787

88-
check_laptop_abundance(user_operating_system, laptop_counts)
88+
check_laptop_abundance(user, laptop_counts)

0 commit comments

Comments
 (0)