Answer to Question #256674 in Python for Raju

Question #256674

List of Unique Tuples


Write a program to print the lists which contain the unique elements in the given list of lists.


Sample Input 1

3

1  2  3

5 10 15

10 20 10 30

Sample output 1

[[1,2,3],[5,10,15]]


1
Expert's answer
2021-10-25T17:56:47-0400
n  = int(input("Enter number of lines: ")) 
string = " "
for i in range(0, n):
    str1 = input("Enter elements of the line:  ")
    string +=  str1 + "\n"
    
list1  = list(string.split("\n")) 
list2  = []
print(list1[0])
for i in list1:
    row  =set(list(i.split(" "))) 
    print(row)
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS