Using the Built-in Function, sum()
(Menu) A B C D E F G H I
Reference: Python Library - Built-in Functions
The list myFloats holds 6 floating point numbers.
There is no loop. total is set using the built-in sum() function.
total is the sum of all the floating point numbers.
myFloats = [4.5, 2.6, 3.8, 3.5, 1.0, 5.7]
total = sum(myFloats)
print(total)
total = round(total, 1)
print(total)
21.099999999999998
21.1
total is rounded to 1 decimal place to hide rounding error.