Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ls1=[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 96]
- ls2=[1, 97]
- ls3=[1, 2, 7, 14, 49, 98]
- ls4=[1, 3, 9, 11, 33, 99]
- g1=[1,2]
- set(list_1).issubset(list_2) # Входит ли list_1 в list_2 ?
- set(g1).issubset(ls1) # True
- set(g1).issubset(ls2) # False
- set(g1).issubset(ls3) # True
- set(g1).issubset(ls4) # False
- def sublist(g1, list2test):
- return set(g1) <= set(list2test)
- def func(g1, list2test):
- ls1 = [i for i in g1 if i in list2test]
- ls2 = [e for e in list2test if element in g1]
- if ls1 == ls2: return True
- else: return False
- def check(lst, sub):
- for i in range(0, len(lst)):
- if lst[i:i+len(sub)] == sub:
- return True
- return False
- print(check([1,3,2,4,6], [1,2])) # False
- print(check([4,5,6,1,2], [1,2])) # True
- def is_in_list(lst_one, lst_two):
- if lst_two != []:
- if lst_two.pop() in a:
- is_in_list(lst_one, lst_two)
- else:
- return False
- return True
Add Comment
Please, Sign In to add comment