def is_prime(num): if num < 2: return False for i in range(2, int(num**0.5) + 1): if num % i == 0: return False return True def find_primes(): primes = [] for num in range(500, 1000): if str(num)[0] == '5' and is_prime(num): primes.append(num) return primes # Display the prime numbers result = find_primes() for prime in result: print(prime)