Q:

Remove duplicates from a list and create a tuple and find the minimum and maximum number using python programming

belongs to collection: Python Data Structure Exercises

1

Remove duplicates from a list and create a tuple and find the minimum and maximum number

Given:

sample_list = [87, 45, 41, 65, 94, 41, 99, 94]

Expected Outcome:

unique items [87, 45, 41, 65, 99]
tuple (87, 45, 41, 65, 99)
min: 41
max: 99

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

sample_list = [87, 52, 44, 53, 54, 87, 52, 53]

print("Original list", sample_list)

sample_list = list(set(sample_list))
print("unique list", sample_list)

t = tuple(sample_list)
print("tuple ", t)

print("Minimum number is: ", min(t))
print("Maximum number is: ", max(t))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Reverse a list in Python... >>
<< Get all values from the dictionary and add them to...