while loops the program allows the user to enter up to numbers if they enter negativethen the program prints stopped early and asks for no more numbers if the user enters no negativesthen the program prints user entered all ten values example here are two ways to check if an integer num is prime prime number is number whose only divisors are and itself the approach on the left uses while loopwhile the approach on the right uses for/break loopi= while <num and num% != = + if ==numprint'prime 'elseprint'not prime 'for in range( num)if num% == print'not prime 'break elseprint'prime 'the idea behind both approaches is to scan through all the integers between and num- and if any of them is divisorthen we know num is not prime to see if value is divisor of numwe just have to check to see if num% is the idea of the while loop version is we continue looping as long as we haven' found divisor if we get all the way through the loop without finding divisorthen will equal numand in that case the number must be prime the idea of the for/break version is we loop through all the potential divisorsand as soon as we find onewe know the number is not prime and we print not prime and stop looping if we get all the way through the loop without breakingthen we have not found divisor in that case the else block will execute and print that the number is prime the guessing gamemore nicely done it is worth going through step-by-step how to develop program we will modify the guessing game program from section to do the followingthe player only gets five turns the program tells the player after each guess if the number is higher or lower the program prints appropriate messages for when the player wins and loses below is what we want the program to look likeenter your guess ( - ) lower guesses left enter your guess ( - )