If n is a positive integer, what is the output of the following snippet of code?
```
P = [x for x in range(1, 2 * n + 1)]
Q = [P[i] - P[i - 1] for i in range(0, n)]
print(sum(P))
```
Q35
7 Aug 2022
Programming in Python · Week 6
Q35.If n is a positive integer, what is the output of the following snippet of code?
```
P = [x for x in range(1, 2 * n + 1)]
Q = [P[i] - P[i - 1] for i in range(0, n)]
print(sum(P))
```