79405101

Date: 2025-02-01 13:58:06
Score: 3
Natty:
Report link

`` I also need to know which item in list 1 was found in which item in list 2. How do I do this please? This should result in
'found 6 from list1 in item 4 List2', but it shows 'found 6 from list1 in item 1 List2'

``

    List1 = [
        [60, 64, 67],
        [62, 67, 72],
        [62, 66, 69],
        [61, 64, 69],
        [64, 65, 67],
        [65, 70, 61],
    ]
    
    List2 = [
        [61, 62, 64, 69],
        [60, 61, 62, 63],
        [64, 65, 67, 69],
        [65, 70, 66, 61],
    ]
    w = 0; v = 0; b = 0
    for x in List1:
        for z in List2:
            is_subset =all([(y in z) for y in x])
            if is_subset == True:
                b = w            
                break
        w = w + 1   
    v = v + 1 
    print("found",w,"from list1 in item ",v,"List2") 

  
``
Reasons:
  • Blacklisted phrase (1): How do I
  • RegEx Blacklisted phrase (1): I do this please
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Tim