+ 6

what is wrong with this code ?

can someone tell me what is wrong with this code? please give me an explanation. https://code.sololearn.com/cdVg1sY43jGs/?ref=app

15th Aug 2019, 1:47 PM
sujay simha
sujay simha - avatar
4 Antworten
+ 7
Convert input to int. Fix indentation on line 6. nums = int(input('Enter a number')) for i in range(1, 20): if nums%i == 0: print('Not prime') break else: print('Prime') Ofc, this only covers syntax errors. You might want to work on fixing the logic.
15th Aug 2019, 1:52 PM
Hatsy Rei
Hatsy Rei - avatar
+ 7
thanks a lot Hatsy Rei
15th Aug 2019, 1:54 PM
sujay simha
sujay simha - avatar
+ 7
thanks a lot Gamma001
16th Aug 2019, 11:16 AM
sujay simha
sujay simha - avatar
+ 3
Also use range(2,20): Since everything is divisible by 1 so nothing will be prime in that case
15th Aug 2019, 3:40 PM
RZK 022
RZK 022 - avatar