# referencing polynomial variables

Suppose I have a polynomial $f$ in the variables $x_1, \dots, x_5$ defined by something like

```
f = 0
for counter in range(1,5):
f += mylist[counter] * var('x' + str(counter))
```

where mylist is some list of integers. Then I can evaluate $f$ by e.g.

```
f.subs(x1=1,x2=2,x3=3,x4=4,x5=5)
```

**Question:** How do I do this evaluation when $f$ is in $n>>0$ variables?

I want to write something like

```
for counter in range(1,n):
f = f.subs(var('x' + str(counter))=counter)
```

but this isn't a valid argument for subs. This must be some way to coerce this to work.