Where am i wrong?

rsingkhuwal4445 shared this question 2 years ago
Answered

If l1={0,1,2,3,5}

and l2=Sequence(Sequence(If(Element(l1, j) > 0, "A", ""), k, 1, Element(l1, j)), j, 1, Length(l1))={{},{A},{A,A},{A,A,A},{A,A,A,A,A}}

but why is l3=Sequence(Sum(Element(l2, i)), i, 1, Length(l2))={0,?,?,?,?}

i am looking for {"","A","AA","AAA","AAAAA"}

I believe if sum(sequence("A",i,1,5)) works then the command for l3 should also work.

Comments (2)

photo
1

Oh, same question again. I explained it in the other thread.

photo
1

In Sequence() and Zip() all elements must be of the same type.

The above rule does not apply in l3. Sum(Element(l2,1)) has the value 0 and therefore the type "numeric" but the remaining elements have the type "text".

l2 must therefore be adjusted so that element(l2,1) gets the value {""} instead of {}. Then all elements have the same type "text".

In the attachment, three alternatives l2A, l2B, l2C are listed, all of which lead to the desired result in l3.

Note: My post and artydent's post overlapped in time (for me).

© 2023 International GeoGebra Institute