r/badcode • u/MysteriousK69420 if: else: if: else: if: else: if: else: if: else: if: else: if: • Feb 16 '22
python presenting, whatever the fk this is
418
Upvotes
r/badcode • u/MysteriousK69420 if: else: if: else: if: else: if: else: if: else: if: else: if: • Feb 16 '22
View all comments
Show parent comment
1
u/flare561 Feb 16 '22 edited Feb 16 '22
Getting rid of
isPrimealtogether and using an else clause on the for loop would be best. The else executes when the loop does not break and is included for this exact pattern. Also the range is wrong, should be 2 to ceil(root) + 1