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 :: how to plot box plot python 
Python :: how to specify variable type in python 
Python :: rotate 2d array 
Python :: pyqt tutorial 
Python :: python write byte 
Python :: str to datetime time 
Python :: how to use def in python 
Python :: numpy put arrays in columns 
Python :: f string add 0 before python 
Python :: python timedelta years 
Python :: TypeError: ‘float’ object is not callable 
Python :: Python Tkinter Frame Widget 
Python :: split path in list of directories 
Python :: fast output python 
Python :: django create view 
Python :: open and write in a file in python 
Python :: cmd to get ip address python 
Python :: turtle.write("Sun", move=False, align="left", font=("Arial", 8, "normal")) 
Python :: concatenation array 
Python :: dbutils.widgets.get 
Python :: python modules 
Python :: python dict del key 
Python :: add a tuple to a dictionary python 
Python :: functions in python 
Python :: python obfuscator github 
Python :: how to add reaction by message id in discord.py 
Python :: python beautifulsoup get option tag value 
Python :: best ide for python 
Python :: map a list to another list python 
Python :: **kwargs in python 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =