250,838 views
31 votes
31 votes
What is the output of this program? Assume the user enters 3, 6, and 11.

numA = 0
for count in range(3):
answer = input ("Enter a number: ")
fltAnswer = float(answer)
numA = numA + fltAnswer
print (numA)
Output:

User Tomoyuki Aota
by
2.9k points

2 Answers

11 votes
11 votes

Answer: 20

Step-by-step explanation:

it is a basic python code
fitAnswer intoduses loop into the given variable

==> intial A=[0]

after addind 3

A=[0,3]=0+3=3

A=[0,3,6]=0+3+6=9

A=[0,3,6,11]=0+3+6+11=20

User Jhermann
by
2.9k points
10 votes
10 votes

Answer:

Output: 23.0

Step-by-step explanation:

1) numA += 3; (3)

2) numA += 9 (12) #3 + 9 = 12

3) numA += 11 (23) #12 + 11 = 23

float(23) = 23.0

User Karakuri
by
2.8k points