Answer:
sum = 0.0
for i in range(0,3):
sum += float(input("Enter a decimal number to sum: "))
print ("Sum: ", sum)
*** Sample Input ***
Enter a decimal number to sum: 1.1
Enter a decimal number to sum: 2.2
Enter a decimal number to sum: 3.3
*** Sample Output ***
Sum: 6.6
Explanation:
For this problem, a method was devised in python to create the sum of three individual decimal numbers.
The first line of code, <em>sum = 0.0</em>, initializes a variable to the float type in which we will store the value of our sum. Note, it is initialized to 0.0 to start from a value of 0 and be considered a float.
The second line of code, <em>for i in range(0,3):</em> is the creation of a for loop control structure. This will allow us to repeat a process 3 amount of times using the iterator i, from value 0 to 3 in this case. Note, 0 is inclusive and 3 is exclusive in the python range. This means the for loop will iterate with, i=0, i=1, and i=2.
The third line of code, <em>sum += float(input("Enter a decimal number to sum: "))</em> is simply asking the user for a number, taking that input and converting it from a string into a float, and then summing the value with the previous value of sum and saving that into sum.
The fourth line of code, <em>print ("Sum: ", sum)</em> is simply displaying the final value that was calculated by adding the three user inputs together which were stored into the variable <em>sum</em>.
Cheers.