141k views
3 votes
What is missing in the following program?

count = 0
1for numA < 3:
count = count + 2
print(numA)

answer:

What is missing in the following program? count = 0 1for numA < 3: count = count-example-1
User MEric
by
4.5k points

2 Answers

6 votes

Answer:

The answer is while. Have a wonderful safe day.

Step-by-step explanation:

User Evelyn Jeba
by
5.0k points
6 votes

Answer:

Replace for with while or if

Step-by-step explanation:

The question has been answered by you before posting. However, I'll help with the explanation.

In python, for is used to iterate through a particular range. So, the for statement as used in the given program is incorrect.

Now, with what do we replace for?

The function of the program is not stated. So, I'll answer with likely options.

1. Replace for with while:

This will repeat the code in the while block as long as the condition numA<3 is true

2. Replace for with if statement:

This checks if numA is true and performs the operations in the [if] block.

The representation would be:

if numA < 3:

count = count + 2

print(numA)

After either of the above has been implemented, variable numA has to be initialized properly before the program functions well.

User Cesc
by
4.7k points