So basically I'm trying to make a program that will do equation for every value of nStart to nEnd. This is my code so far
def summation(nStart , nEnd , eqn):
sum = 0
while nStart - 1 != nEnd:
sum = sum + eqn
nStart += 1
return sum
print summation(1 , 5 , n + 1)
I get that n is not defined in the last line. I guess it's because I have n + 1 but how do I solve that? I tried making n = 0 but then that doesn't help because then eqn is just 1 and not an equation.