Questions
Write a python program to display Prime numbers from 100 to 500.
Last Updated : 22 Nov 2026
Jan 22, Jul 24
Solution:
def is_prime(num):
"""Returns True if num is prime, otherwise False."""
if num <= 1:
return False
# Check divisibility up to the square root of the number
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
return False
return True
# Define the limits
lower_limit = 100
upper_limit = 500
print(f"Prime numbers between {lower_limit} and {upper_limit} are:")
# Loop through the range (inclusive of 500)
for number in range(lower_limit, upper_limit + 1):
if is_prime(number):
print(number, end=" ")
✔
Verified by Expert