+ 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
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.
+ 7
thanks a lot Hatsy Rei
+ 7
thanks a lot Gamma001
+ 3
Also use range(2,20):
Since everything is divisible by 1 so nothing will be prime in that case