27 Apr 2022

Posted on:

21 Apr 2022

0

# Question 16 Clarification:

Hi,
What did you mean here? Write a function to determine whether all numbers in a list are unique. do we need to explicitly say which one is unique or we just need to identify if all of them are unique?
Here is a sample of my solution:
def unique(list1):
uni='Not Unique'
unique_list = []
for x in list1:
if x not in unique_list:
unique_list.append(x)
if len(list1) == len(unique_list):
uni= 'Unique'
return uni
list1 = [10, 20, 30, 40]
unique(list1)

Best,
Christian

Instructor
Posted on:

21 Apr 2022

0

Hey Christian,

The task is to determine whether all numbers are unique, there is no need to identify the unique numbers themselves. I think your solution is great and solves the task as expected. You can also study Giles' solution for an alternative approach :)

Kind regards,
365 Hristina

Posted on:

22 Apr 2022

0

Hi Hristina,

Where can I find Giles' solution so I can see an alternative approach? Thank you.

Best,
Christian

Instructor
Posted on:

27 Apr 2022

0

Hey Christian,

By clicking on the dropbox link, you will see two files - Python_Questions.txt containing the exercises and Python_Solutions.py where you will find Giles' solutions.

Kind regards,
365 Hristina