#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    19
    Rep Power
    0

    Compare 2 groups of numbers


    This is my last question.

    With calculations I have made 192 numbers (num1 to num192)
    Their value can be anything,also negative and also doubles.
    example:
    num1=-1O
    num2=23

    The second row are 60 numbers (number1 to number60)
    Their value is 1 to 60
    example:
    number1=1
    number2=2
    number60=60

    From the 60 numbers I want to delete every number that is the same number as in the 192.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    100
    Rep Power
    2
    Check out your previous problem, got the absolute answer.
    Started working on this one.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    158
    Rep Power
    2
    take a look at sets, specifically the intersection method.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    19
    Rep Power
    0
    That was a very good solution Akshat1,Thank you.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    19
    Rep Power
    0
    Thanks
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    19
    Rep Power
    0
    For the first row of 192 numbers maybe I must eliminate the negatives and doubles in it.
    Also eliminate the numbers lower than 1 and higher dan 60.
    And fill it up with value 0 for numbers not in that list.
    Then the first row can be 60 numbers to compare with the other 60.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    19
    Rep Power
    0
    I think this is the solution.
    I must try it with 192 numbers

    num1=1
    num2=2
    num3=3
    num4=5
    num5=3
    num6=6

    number1=2
    number2=5
    number3=6

    t = [num1, num2, num3, num4, num5 ,num6]
    s = [number1, number2, number3]

    print list(set(t) - set(s))

IMN logo majestic logo threadwatch logo seochat tools logo