Exercise: Primeness (for
)¶
Convert the program from exercise Exercise: 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
and for
solutions. Which one appears more
readable?