Python's Break, Continue and Pass Examples
Problem 1: If user input number equal to 55 than loop close
Example 1
while True:
num = int(input("Enter a number: "))
if num == 55:
print("Correct")
break
else:
print("Incorrect, Try again") Problem 2: Check prime numbers from 1 to 30
Example 2
for i in range(1, 31):
for j in range (2, i):
if i % j == 0:
break
else:
print(i, end=" ")