Identify and correct the problem with following code.
countdown=10 # count from 10 to 1
while countdown>0 :
print (countdown, end=” ”)
countdown - 1
print(“Finally”)
Answers
Answered by
3
Answer:
counter decrement is not enclosed in the loop. check for the indentation
Answered by
2
countdown=10 # count from 10 to 1
while countdown>0:
print (countdown, end=" ")
countdown -= 1
print("Finally")
Problem:
Counter was not decremented creating an infinite loop.
Solution:
counter -= 1
Similar questions
Math,
1 month ago
Hindi,
1 month ago
Math,
3 months ago
Science,
9 months ago
Psychology,
9 months ago