Difference between two lists in python

0 votes
Given two lists, can we obtain all the elements that are present in one list but not there in another?
May 24, 2018 in Python by kaalabilli
• 1,090 points
1,283 views

1 answer to this question.

0 votes
difference = list(set(list1) - set(list2))
answered May 24, 2018 by Nietzsche's daemon
• 4,260 points

Related Questions In Python

0 votes
3 answers
+1 vote
2 answers

Difference between append vs. extend list methods in Python

Python append() method adds an element to ...READ MORE

answered Aug 21, 2019 in Python by germyrinn
• 200 points
6,788 views
0 votes
1 answer

Difference between append vs. extend list methods in Python

append: Appends object at the end. x = ...READ MORE

answered Aug 8, 2018 in Python by bug_seeker
• 15,390 points
363 views
+1 vote
1 answer

What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

answered Aug 22, 2018 in Python by Priyaj
• 57,530 points
695 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,050 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

Copying lists in python

Assigning one list to another one simply ...READ MORE

answered Apr 30, 2018 in Python by Nietzsche's daemon
• 4,260 points
60 views
0 votes
1 answer

Using Lists and Tuples in Python

if you are familiar with C programming, ...READ MORE

answered May 29, 2018 in Python by Nietzsche's daemon
• 4,260 points
137 views