Answer:
20
Step-by-step explanation:
assuming the print statement is not indented, the program effectively calculates 2+5+6+7.
The range(...) is excluding the end value (8 in this case).
The output is 20
Given:
numA = 2
for count in range(5,8):
numA = numA + count
print(numA)
Required:
Determine the output
The first line of the program initializes numA to 2.
The next iteration sum up integers from 5 to 7 (i.e. 8 - 1) to the initialized value of numA
So, numA becomes
Hence, the output is 20
5.6m questions
7.4m answers