0
$\begingroup$

How would I translate this code into a mathematical formula?

myset={4,2,5,26,8,1,2}, d0=[], d1=[], dnp1=[] for i in range(myset):     if   i==0: d0=myset[i]     elif i==1: d1=myset[i]     else:      dnp1+=myset[i] 

(a $\LaTeX$ example would be great)

  • 0
    I have received this solution over IRC, it is useful but being able to more explicitly do an `if` `elif` type thing would be better: $$ d1 = myset_1, d0 = myset_0, dnp1 = \sum_{i >= 2} myset_i $$2012-07-06
  • 0
    If $i \in \{4, 2, 5, 26, 8, 1, 2\}$ then how come you test for $i = 0$?! $i$ will never be zero.2012-07-06

1 Answers 1