222k views
3 votes
Question 11 Which one of the following is an infinite loop?

A. for i in range(-1):
print(i)
B. X=10
while x <= 10:
x=x-1
print (x)
C. for I in range (10):
print (I -10)
D. none of the above


User Floremin
by
7.9k points

1 Answer

6 votes

Answer:

B.

x=10

while x <= 10:

x=x-1

Step-by-step explanation:

Since x starts at 10 and keeps decreasing, its value will be always less than 10 so the loop will never end

User Shane Voisard
by
7.8k points