Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python subset

n,su = map(int,input().split())
A = list(map(int,input().split()[:n]))
s = []
for i in range(0,len(A)+1):
    for j in range(i+1,len(A)+1):
        s.append(A[i:j])
        
for k in s:
    if sum(k) == su:
        f = 1
        break
if f == 1:
    print("TRUE")  
else:
    print("FALSE")
Comment

subset in python

    smallSet = {'a', 'b'}
    superSet = {'a', 'b', 'c'}

    print(smallSet.issubset(superSet)) # This will return True
    print(superSet.issubset(smallSet)) # This will return False
Comment

PREVIOUS NEXT
Code Example
Python :: pandas nat to null? 
Python :: making your own range function in python 
Python :: how to declare global variable in python 
Python :: pandas create sample dataframe 
Python :: Swap first and last list elements 
Python :: multiple plot in one figure python 
Python :: create virtual env pyhton3 
Python :: python check variable size in memory 
Python :: sns boxplot 
Python :: while loop py 
Python :: how to make software in python 
Python :: batch gradient descent 
Python :: how to make tkinter look modern 
Python :: create new column with mask pandas 
Python :: python threading return value 
Python :: get ticks pygame 
Python :: drop 0 in np array 
Python :: check runtime python 
Python :: python random number generator no duplicates 
Python :: use gpu for python code in vscode 
Python :: python call function in class 
Python :: convert list of lists to numpy array matrix python 
Python :: zip a directory in python 
Python :: python byte like to string 
Python :: python redirect with button click 
Python :: how to add a linebreak in python 
Python :: python multithreading 
Python :: super in django manager 
Python :: django login required 
Python :: pandas groupby most frequent 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =