Guest User

Untitled

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