Exercise: Primeness (for
)¶
Convert the program from exercise Exercises: Primeness (while) as follows.
Use a
for
loop instead of awhile
loopUse the
range()
function to specify the range of divisor candidates
Compare both
while
andfor
solutions. Which one appears more readable?