Open in CoCalc
sum([binomial(10,np) for np in range (0,10)])
1023
range(0,10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
sum([binomial(10,np) for np in [0..10]])
1024
sum([binomial(10,np) for np in range(11)])
1024
help(range)
Help on built-in function range in module __builtin__: range(...) range(stop) -> list of integers range(start, stop[, step]) -> list of integers Return a list containing an arithmetic progression of integers. range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0. When step is given, it specifies the increment (or decrement). For example, range(4) returns [0, 1, 2, 3]. The end point is omitted! These are exactly the valid indices for a list of 4 elements.