From 3e98f4331b56c4f8aa7dc547d677d47f3579c430 Mon Sep 17 00:00:00 2001 From: ahmedabougabal Date: Fri, 17 Jan 2025 14:58:10 +0200 Subject: [PATCH] feat: add solution to the first challenge in a python learning path course on Linkedin learning copies the content of a list inside a set as it perserves unique records sorts the set --- deduplicateAndSort.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 deduplicateAndSort.py diff --git a/deduplicateAndSort.py b/deduplicateAndSort.py new file mode 100644 index 0000000..c0e0bcf --- /dev/null +++ b/deduplicateAndSort.py @@ -0,0 +1,9 @@ +# Python code​​​​​​‌‌​​​‌‌‌‌‌‌‌​​‌‌​‌​‌‌‌​‌‌ below +# Use print("messages...") to debug your solution. + +def prepare_list(animals): # animals is a list of strings + # Your code goes here + # need to deduplicate this list, i have read that a set perserves unique records only + unique = set(animals) + sorted_set = sorted(unique) + return sorted_set