This function, that I got from this question, is as follows:
def f(n, p, k, t):
return sum(sum(1 if n == 3 else
(0 if k == 1 else
(1/36) * f(n-1, p, k-1, t-(max(p,i)))
for i in xrange(1, 7)))
for p in xrange(1, 7))
print sum(f(5,j,3,15) for j in xrange(1, 7))
When I run this, I get this long traceback error sequence ending in:
File "C:/Users/r/Documents/school/IB/Computer Science HL/Other Languages/Problem240/Problem240 - recursive2.py", line 6, in <genexpr>
for p in xrange(1, 7))
TypeError: 'int' object is not iterable
Can someone please tell me what's going on? What is wrong with my code and how would I fix it? Thank you!