Why this code prints the output 2 times? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code prints the output 2 times?

This is a Python code which receives an integer and tell u if this number is Prime or not... But this code prints "not prime" 2 times... Why???? https://code.sololearn.com/cKxpMhNbkv9t/?ref=app

16th Oct 2022, 3:33 AM
Amateur
2 Answers
+ 4
Because there is no break so if else part may execute many times
16th Oct 2022, 4:50 AM
A͢J
A͢J - avatar
+ 1
A͢J Thank u
16th Oct 2022, 8:02 AM
Amateur