Remove duplicates from a list and create a tuple and find the minimum and maximum number
Python Python List (Article) Python List (Program)
147
Given Input:
sample_list = [87, 45, 41, 65, 94, 41, 99, 94]
Expected Output:
unique items [87, 45, 41, 65, 99] tuple (87, 45, 41, 65, 99) min: 41 max: 99
Program:
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))
Output:
Original list [87, 52, 44, 53, 54, 87, 52, 53] unique list [44, 52, 53, 54, 87] tuple (44, 52, 53, 54, 87) Minimum number is: 44 Maximum number is: 87
This Particular section is dedicated to Programs only. If you want learn more about Python. Then you can visit below links to get more depth on this subject.