After your first snippet of code, I noticed that you wrote that 'This loop runs until the test case passes.'
Actually, the loop runs until the test case passes or fails.
Also, do you think more comments on our code may speed up understanding? For example, a comment in the first snippet telling us that we are looping through to check for prime characteristics may help me the reader to quickly get what the code does.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.