input a integer X and tell if it is a prime. If it is a prime, output 'Y' If not, output 'N' and the smallest prime factor.
Here is the program I have tried to write.
X = int(input('enter a integer X:')) for i in range(2, X): if X % i == 0: print('Y') else: print('N')
But I would like to print just one time 'Y' or 'N'. And I also do not know how to make the smallest prime factor show on my program result.
Thank you all for helping me