Exercises for while loops
1. What is the output?
i = 0
while i < 3:
print(i)
i = i + 1
2. What is the output?
i = 0
while i < 4:
print(i)
i = i + 2
3. What is the output?
i = 1
while i < 10:
print(i)
i = i * 2
4. What is the output?
i = 0
j = 10
while (i+j) > 7:
print(i, j)
i = i + 1
j = j - 2
5. What is the output?
i = 1
j = 10
while j > 0:
print(i, j)
i = i + 1
j = j // 2