An accumulator starts at a known value and changes once per step. The sum of the first three positive integers is 1 + 2 + 3.
Print the stops for a three-floor lift.
highest_floor = 3
for floor in range(1, highest_floor + 1):
print(f"Floor {floor}")
# Floor 1
# Floor 2
# Floor 3The stop value of a range is excluded. Adding one makes the top floor part of the trip. The same range can supply numbers for a calculation.
Complete rung_total(top) by adding the integers from 1 through top. When top is zero the total is zero. Try writing it with a for loop.
rung_total(4) # 10