Guest User

Untitled

a guest
Jan 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. ls1=[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 96]
  2. ls2=[1, 97]
  3. ls3=[1, 2, 7, 14, 49, 98]
  4. ls4=[1, 3, 9, 11, 33, 99]
  5.  
  6. g1=[1,2]
  7.  
  8. set(list_1).issubset(list_2) # Входит ли list_1 в list_2 ?
  9. set(g1).issubset(ls1) # True
  10. set(g1).issubset(ls2) # False
  11. set(g1).issubset(ls3) # True
  12. set(g1).issubset(ls4) # False
  13.  
  14. def sublist(g1, list2test):
  15. return set(g1) <= set(list2test)
  16.  
  17. def func(g1, list2test):
  18. ls1 = [i for i in g1 if i in list2test]
  19. ls2 = [e for e in list2test if element in g1]
  20. if ls1 == ls2: return True
  21. else: return False
  22.  
  23. def check(lst, sub):
  24. for i in range(0, len(lst)):
  25. if lst[i:i+len(sub)] == sub:
  26. return True
  27. return False
  28.  
  29. print(check([1,3,2,4,6], [1,2])) # False
  30. print(check([4,5,6,1,2], [1,2])) # True
  31.  
  32. def is_in_list(lst_one, lst_two):
  33. if lst_two != []:
  34. if lst_two.pop() in a:
  35. is_in_list(lst_one, lst_two)
  36. else:
  37. return False
  38. return True
Add Comment
Please, Sign In to add comment