I’m trying to solve this puzzle my sister’s teacher gave to her. It’s to get 24 out of 4 numbers 20, 10, 11 and 4.

So I wrote this program, and here’s the code and the result:

```
a=0
b=1
c=2
d=3
x = 0
integer = ["20", "10", "11", "4"]
operation = ["*", "/", "+", "-"]
while x != 24:
formula = integer[a]+operation[a]+integer[b]+operation[b]+integer[c]+operation[c]+integer[d]
x = formula
if a <= 3:
a += 1
elif a == 3:
a -= 1
if b <= 3:
b += 1
elif b == 3:
b -= 1
if c <= 3:
c += 1
elif c == 3:
c -= 1
if d <= 3:
d += 1
elif d == 3:
d -= 1
print formula
if x == 24:
print formula
```

Result:

```
[email protected]:~$ python zainabhomework.py
20*10/11+4
Traceback (most recent call last):
File "zainabhomework.py", line 11, in <module>
formula = integer[a]+operation[a]+integer[b]+operation[b]+integer[c]+operation[c]+integer[d]
IndexError: list index out of range
```

thanks in advance