I have a list of fractional numbers to get the total of them. I'm not allowed to use fraction module other than for, while loops. Can someone help me, please? I'm studying by myself.
Here is my question :
Write a loop that calculates the total of the following series of numbers:
1/30 + 2/29 + 3/28 + ... + 30/1
Update
Here is the code I wrote:
starting_number = 1 / 30
ending_number = 30/1
total = 0.0
for number in range(starting_number, ending_number, starting_number + 1 / ending_number -1):
total += number
print(total)
Here is the output:
Traceback (most recent call last):
File "C:\Users\jimsrc\Desktop\repo\New folder\test2.py", line 4, in <module>
for number in range(starting_number, ending_number, starting_number + 1 / ending_number -1):
TypeError: 'float' object cannot be interpreted as an integer
Process finished with exit code 1