The program is written in Python and performs the following operations:
The final output of the program will be the set of unique tuples in the list "val" and the number of unique tuples in the list. The set comprehension will remove any duplicate tuples from the list and the length of the set will give the number of unique tuples in the list.
val = [(3, 4), (1, 2), (4, 3), (5, 6)] print("Original list : ",val) l = list(set(tuple(sorted(s)) for s in val)) res = len(l) print("Unique tuples Frequency :",l) print("Unique tuples Frequency Count : " ,res)
Original list : [(3, 4), (1, 2), (4, 3), (5, 6)] Unique tuples Frequency : [(1, 2), (3, 4), (5, 6)] Unique tuples Frequency Count : 3
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions