This program is calculating the product of all unique elements after removing the duplicates from the input list "a". The program first converts the input list "a" into a set, which automatically removes all duplicates and then converts it back into a list. This new list "b" now only contains unique elements from the original list "a".
Then the program uses a for loop to iterate through the unique elements in the list "b" and for each element it multiplies the previous product with the current element. Finally, the program prints the final product of all the unique elements in the list "a" after the duplicates have been removed.
a = [2,1,2,4,6,4,3,2,1] print ("Original list : " + str(a)) b=list(set(a)) p=1 for i in b: p*=i print ("Duplication removal list product : " + str(p))
Original list : [2, 1, 2, 4, 6, 4, 3, 2, 1] Duplication removal list product : 144
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions