Skip to content

Commit 2cd708e

Browse files
committed
Improve clarity of printed results
1 parent 579f83d commit 2cd708e

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

sprint5-prep/prep8-exercise.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,25 @@ def find_possible_laptops(laptops: List[Laptop], person: Person) -> List[Laptop]
101101

102102
os_count = Counter(laptop.operating_system for laptop in laptops)
103103
max_count = max(os_count.values())
104-
print(max_count)
104+
105+
print(f"\nHello {person.name}, here is the laptop availability info:")
106+
print(f"You have requested: {person.preferred_operating_system.value}")
107+
108+
# print(max_count)
105109
most_available_os = []
106110
for os in os_count:
107111
count = os_count[os]
108112
if count == max_count:
109113
most_available_os.append(os.value)
110-
print(most_available_os)
114+
# print(most_available_os)
111115
possible_laptops = find_possible_laptops(laptops, person)
112116
print(
113-
f"Count of available {person.preferred_operating_system.value} laptops for {person.name} is : {len(possible_laptops)}"
117+
f"Count of available {person.preferred_operating_system.value} laptops for you is : {len(possible_laptops)}"
114118
)
115119

120+
formatted_os = [f"{os.value} {os_count[os]}" for os in os_count if os_count[os] == max_count]
121+
print(f"Most available operating systems: {', '.join(formatted_os)}")
122+
116123
if len(possible_laptops) < max_count:
117124
print(
118125
f"Note: If you are willing to accept : {" or ".join(most_available_os)}, you are more likely to get a laptop."

0 commit comments

Comments
 (0)