Skip to content

Commit 6f693c7

Browse files
committed
updated get_matching_laptops
1 parent d691338 commit 6f693c7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

prep-exercises/laptopAllocated.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def get_matching_laptops(laptops: List[Laptop], person: Person) -> List[Laptop]:
2929
if laptop.os == person.preferred_os:
3030
matches.append(laptop)
3131

32-
return matches
32+
if matches:
33+
return matches
34+
35+
print(f"No laptops found with {person.preferred_os.value}. Returning available laptops instead.")
36+
return laptops
3337

3438

3539
laptops = [

0 commit comments

Comments
 (0)