looking to achieve is to replace every 25 value in a list with 0, 40 with 1, 15 with 2 and 60 with 3. This is what I have so far:
listArray = x
searchList = y
writeList = z
for n, i in enumerate(listArray):
if i == searchList[0]:
listArray[n] = writeList[0]
elif i == searchList[1]:
listArray[n] = writeList[1]
elif i == searchList[2]:
listArray[n] = writeList[2]
elif i == searchList[3]:
listArray[n] = writeList[3]
a = listArray
Any help appreciated,
Cheers,
…
bjects that are a member of A,
or B, or both. The union of {1, 2, 3} and {2, 3, 4}
is the set {1, 2, 3, 4}. Intersection of the sets A and B,
denoted A ∩ B, is the set of
all objects that are members of both A
and B. The intersection of {1, 2, 3} and {2, 3, 4}
is the set {2, 3}set difference of U and A, denoted U
\ A. The complement of {1,2,3}
relative to {2,3,4} is {4} , while, conversely, the complement of {2,3,4} relative to {1,2,3}
is {1}Symmetric difference of sets A and B
is the set of all objects that are a member of exactly one of A and B
(elements which are in one of the sets, but not in both). For instance,
for the sets {1,2,3} and {2,3,4} , the symmetric difference set is {1,4} . It is the set difference of the union and
the intersection, (A ∪ B) \ (A
∩ B).Cartesian product of A and B,
denoted A × B, is the set
whose members are all possible ordered
pairs (a,b) where a is a member of A
and b is a member of B.Power
set of a set A is the set
whose members are all possible subsets of A.
For example, the power set of {1, 2} is { {}, {1}, {2}, {1,2} }This is a link to Set theory explanationhttp://en.wikipedia.org/wiki/Set_theoryThanks…
p them in two different group of points, but mantaining their structure, because first I need to move them in different ways and later group them again to create lines between them:
0. null 0. a
1. b 1. null
2. c 2. null
3. null 3. d
4. null 4. e
5. f 5. null
Thank you
…
need to be set, maybe could help you. Group tagged Classify is the relevant part. More information is available here.
Classify items (say points from a grid, or circles, or rectangles to be extruded) by any parameter of your choice (say distance from attractor, or radius, or height of extrusion) allows you to set any property by class: radius, colour, or whatever, even height of extrusion.
An illustrative example:
1 Heights in [1, 17]
2 Subintervals: {[1, 2], [2, 2.03], [2.03, 4], [4, 9.1], [9.1, 16.99], [16.99, 17]}
3 New values: { 0.3, 2.9, 5.5, 13.2, 15.0025, 17 }
4 Examples: 9.23 becomes 15.0025 and 1.7 becomes 0.3
Every height belonging to first subinterval —[1, 2]— becomes 0.3, every height in [2, 2.03] becomes 2.9, and so forth. Actually, every rectangle with its —old— height of extrusion belonging to a specific subinterval gets corresponding value according to 3 for its —new— height of extrusion.
In order to perform a true partition —classes— covering 1, boundaries should be a monotonically increasing succession, and subintervals should be half-open as far as boundaries (2, 2.03, 4, 9.1 and 16.99) can’t belong to more than one subinterval/class —classes are defined to be mutually exclusive and collectively exhaustive—, but this isn’t technically necessary; overlapping subintervals are allowed by creating duplicates: same rectangle is extruded twice (or more times) but different heights, also according 3, are used for each extrusion.
Notice that 3 could be even more exotic:
{0.01, 0.1, 0.02, -0.3, -0.05, -0.8}
{-5, 0, 3, 0, -1, 0}
{-11/2, -9/2, π, 5/2, -3/2, -1/2}
{O, T, R, F, V, S}
You’ll have to recycle classify by distance, but I think for sure it will help you. If you need further assistance, or you have any feedback, let me know.
…
E.g.:
0 2 (A) = 2
1 2+4 (A+B) = 6 (AB)
2 6+4 (AB+C) = 10 (ABC)
3 10+6 (ABC+D) = 16 (ABCD)
etc.
Into a new list numbers:
{2,6,10,16, etc} that adding the previous number with the next number.
Thanks,
daniel
…