In Python I believe a list is considered as a 1 dimensional vector.
how do I define a list A = [1, 2, 100, 300] for example whose elements is of set B provided that the element is more than zero:
B ={-1, -2, 1, 2, -300, 100, -100, 300}
would this definition below be correct ? :
$$A = [h]_{\forall h\in B: h>0}$$
Thanks !
A = [x for x in B if x > 0]
. IfB
is originally defined as a set, it will not include repeated elements, but ifB = [-1, -2, 1, 2, -300, 100, -100, 2, 300, 1]
(a list), then bothB
andA
will include repeated elements. – John Palmieri Jul 25 '21 at 03:53