Advertisement
here2share

# b_match_3_in_sublists.py

Apr 15th, 2023
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. # b_match_3_in_sublists.py
  2.  
  3. main_list = [[3, 4, 5, 6], [3, 1, 4, 2], [1, 0, 4, 2]] # Example main list
  4. nums = [1, 2, 3] # Numbers to check
  5.  
  6. for sublist in main_list:
  7.     if all(num in sublist for num in nums):
  8.         print("--> All numbers [1, 2, 3] are in the sublist", sublist)
  9.     else:
  10.         print("Not all numbers [1, 2, 3] are in the sublist", sublist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement