I am trying to write a loop that calculates the total of the following series of numbers: 1/30 +2/29+3/28+…+30/1. I'm having trouble figuring out how to add, because the program below just displays the total as 0.033333333....
def main():
A=1
B=30
sum=(A/B)
while A<=30:
A+=1
B-=1
print('Total:',sum)
main()
f = sum(fractions.Fraction(i, 31-i) for i in range(1, 31)); print(f, float(f))