Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS PYTHON THIS ANSWER IS WRONG def unique_list(l): a_set = set(l) number_of_unique_values = len(a_set) print(number_of_unique_values) x = [] for a in l: if a

image text in transcribed

THIS IS PYTHON

THIS ANSWER IS WRONG

def unique_list(l): a_set = set(l) number_of_unique_values = len(a_set) print(number_of_unique_values) x = [] for a in l: if a not in x: x.append(a) return x print(unique_list([1,2,3,3,3,3,4,5])) 

2. Write a function get_unique( ) that takes a list of numbers and returns the number of unique values and a list containing all unique values. Example: list1 =[3,1,4,1,5,9,5,4] n_unique, list_unique = get_unique(list1) print(n_unique) print(list_unique) Output: 5 [1,3,4,5,9] (The order does not matter)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How does the production volume affect break-even analysis?

Answered: 1 week ago

Question

Define and measure service productivity.

Answered: 1 week ago