elif in list
Is it possible to use a recursive list. My problem is that I can code a list with and if condition. But I have not found the way to insert inside a list an elif
.
For instance in pur Python to code x[t] = a x[t-1] + b, x[0] given
is coded without any difficulties. But what I search is the list way as in Mathematica (<- I know my mother often told me not tell swear words).
In fact I have two problems the first is purely recursive like mathematica code
RecurrenceTable[{a[n + 1] == 3 a[n], a[1] == 7}, a, {n, 1, 10}]
here the if
condition would be some thing like
A=[a[n + 1] == 3 a[n] for i in range(10) if n > 1 elif : a[n] == 7 if n in range(0)]
but also
A=[something|i] A=[something(i) for i in range(..) if condition1 on something something(i) elif condition2 on something]
something(i)]