We already know that prime numbers can only divided fully by themselves or just 1 and because of that characteristic treat of prime numbers we can make a loop about checking all the numbers that divides a specific number between 500 and 600 and see if it is a prime number or not. listofnums = list of numbers from 500 to 599 for each num in listofnums: for each i in numbers from 2 to num - 1: if num is divisible evenly by i: exit the loop else: num is a prime number, print it