i'd calculate sum of following numbers using loop
1/3 + 3/5 + 5/7 + . . . + 95/97 + 97/99 print sum
so far wrote print fractions
s = '' j in range(30, 0, -1): s += "{}/{} + ".format(31-j, j) sum = +=j print sum
to sum fractions of x/(x+2) x odd, can use range(start, stop, step) start 1, stop 98, , step size 2. passing sum give answer:
sum(x/(x+2.0) x in range(1,98,2))
Comments
Post a Comment