0
Prime number
x=int(input('enter the num :')) factors=[ ] for i in range(1,x): if x%i==0: factors.append(i) if sum(factors) == 1: print('its a prime') else: print('not a prime') code is executing without any errors, but else part is not executing...i.e. when I give a non-prime number....I'm not seeing else print statement or any errors.... please help me.
1 Antwort
+ 11
Works for me...What output did you expect?
https://code.sololearn.com/cA3D0UGjasmG/?ref=app