Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sum of subsets (Python)
import numpy as np k = 3 A = [ 1, 2, 3, 4, 5 ] kk = min( len( A ), k ) + 1 S = np.zeros( kk, dtype=int ); S[0] = 1 for a in A: S[1:kk] = S[1:kk] + a * S[0:kk-1] print( S.sum() - 1 )
run
|
edit
|
history
|
help
0
PyList
fb_series
Idd or even
denemeler
Game4
Removing punctuation from strings
Lesson 2-ex
prog1.py
Byear
Your mom