1. What will the following code display? for i in range(3):
for j in range(2):
print(f'({i}, {j})')
|
2. What will the following code display? for i in range(5):
if i == 4:
break
print(i)
|
3. What will the following code display? for num in range(10):
if num == 3:
continue
print(num)
|
4. Which loop is more appropriate when the number of repeats is unknown in advance? |
5. How would you calculate the sum of all numbers from 1 to 100 using a loop `for`? |
6. What will the following code display? for i in range(3):
for j in range(3):
print(i, j)
|
7. What's the break doing in a replay? |