# generate lower and upper bound of the sum
start = dynexite.random(1,5)
end = dynexite.random(6,10)
# concatenate latex formula with variables
x = '$$ \sum_{i=' + str(start) + '}^{' + str(end) + '} i $$'
# computaion of the correct answer
result = 0
for value in range(start, end+1):
result += value
# generate different answer options
# that are not equal to the correct solution
options = dynexite.sample(range(20,51),3)
while(result in options):
options = dynexite.sample(range(20,51),3)