Computer Science
Predict the output of the following code fragments:
count = 0
while count < 10:
print ("Hello")
count += 1
Python
Python Control Flow
34 Likes
Answer
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Working
The while loop executes 10 times so "Hello" is printed 10 times
Answered By
11 Likes
Related Questions
Rewrite following code fragment using while loops :
for i in range(1, 16) : if i % 3 == 0 : print (i)
Rewrite following code fragment using while loops :
for i in range(4) : for j in range(5): if i + 1 == j or j + 1 == 4 : print ("+", end = ' ') else : print ("o", end = ' ') print()
Predict the output of the following code fragments:
x = 10 y = 0 while x > y: print (x, y) x = x - 1 y = y + 1
Predict the output of the following code fragments:
keepgoing = True x=100 while keepgoing : print (x) x = x - 10 if x < 50 : keepgoing = False