Python Forum
Output difference from 2 lists of different sizes with words
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Output difference from 2 lists of different sizes with words
#6
I'd do it this way:
>>> set1 = set(['guava','apple','banana','strawberry','orange'])
>>> set2 = set(['orange','pineapple','apple'])
>>> set3 = set(['banana', 'guava', 'strawberry', 'pineapple'])
>>> set1.difference(set2)
{'strawberry', 'banana', 'guava'}
>>> set3.difference(set1)
{'pineapple'}
Reply


Messages In This Thread
RE: Output difference from 2 lists of different sizes with words - by Larz60+ - Sep-02-2022, 05:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create a table with different sizes of columns in MS word pepe 8 1,678 Dec-08-2023, 07:31 PM
Last Post: Pedroski55
  Printing effect sizes for variables in an anova eyavuz21 2 1,007 Feb-01-2023, 02:12 PM
Last Post: eyavuz21
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,871 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Split dict of lists into smaller dicts of lists. pcs3rd 3 2,444 Sep-19-2020, 09:12 AM
Last Post: ibreeden
  Difference in list output OokaydO 6 3,386 Nov-09-2019, 12:33 AM
Last Post: OokaydO
  converting data sizes like: 4k, 32k, 4m, 16m, 1g, etc Skaperen 1 2,209 Jul-16-2019, 01:37 AM
Last Post: Skaperen
  sort lists of lists with multiple criteria: similar values need to be treated equal stillsen 2 3,319 Mar-20-2019, 08:01 PM
Last Post: stillsen
  How to format text to modify itself for different console sizes. FWendeburg 0 1,609 Feb-18-2019, 06:43 PM
Last Post: FWendeburg
  Compare all words in input() to all words in file Trianne 1 2,790 Oct-05-2018, 06:27 PM
Last Post: ichabod801
  Convert file sizes: will this produce accurate results? RickyWilson 2 8,185 Dec-04-2017, 03:36 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020