Answer to Question #336111 in Python for Elle Joy

Question #336111

Elle Joy Vasquez


Preliminary Test 03


Create a Python function that takes a list and returns a new list with unique elements of the first list.


Sample List: [1,2,3,3,3,3,4,5]


Unique List: [1, 2, 3, 4, 5]

1
Expert's answer
2022-05-01T19:05:54-0400
def uniq_numbers(lst:list) -> list:
	res = []
	for num in lst:
		if num not in res:
			res.append(num)
	return res


print(uniq_numbers([1,2,3,3,3,3,4,5]))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS