1313from enum import Enum
1414import sys
1515
16- # ----- Classes and Enums
16+ # ----- Classes and Enums
1717class 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 ("\n If 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
5151laptops = [
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
6969user_name = input ("Please enter your full name:\n " )
7070user_age_str = input ("Please enter your age:\n " )
7171
@@ -85,4 +85,4 @@ def check_laptop_abundance(operating_system: OperatingSystem, laptop_counts: dic
8585count_laptops (laptops , laptop_counts )
8686print (f"\n The 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