why is 4 being printed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why is 4 being printed?

why is 4 being printed in range 1 to 10? https://code.sololearn.com/cYltglr88UM8/?ref=app

7th Aug 2021, 4:13 PM
Harsha S
Harsha S - avatar
1 Answer
+ 4
Harsha S Because range(2, 2) will return empty list and isPrime function will return 1 in case of 4 there should be range(2, num // 2 + 1)
7th Aug 2021, 4:21 PM
A͢J
A͢J - avatar