Ask Question

Use the line of code below to choose the correct answer. while (count < 7) : print 'Great!' This code is an example of a (n)

+5
Answers (1)
  1. 14 May, 12:07
    0
    infinite loop

    Explanation:

    A loop is a portion of code that is repeated a number of times, based on a condition that is evaluated at the beginning (or end, depending the structure chosen) of the loop.

    If the condition is evaluated as true, then the code is executed.

    Normally, within the looped code or within the test itself, there will be some changes done to the test variable value to make it run only the desired number of times.

    If a code doesn't alter the test variable value, and the test is true, the loop will execute indefinitely because it will never never encounter a false value to stop it. That's called an infinite loop, and it's a big programmer's mistake.

    That's the case with this line of code. If seen as is alone, there's no change of value of the 'count' variable ... so it will either never run (if count > 6) or will run continuously (if count < 7).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Use the line of code below to choose the correct answer. while (count < 7) : print 'Great!' This code is an example of a (n) ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers