try: number = int(input("Enter any Number:")) flag = 0 if isinstance(number, int): number = int(number) if number ==1: print('Isnt either')(quit) elif number ==2: print(number, 'Is a prime number')(quit) else: for i in range(2, number): if number % i == 0: flag=1 break else: print(number, 'Is not a prime number') except EOFError: print(number, 'Is a prime number') except ValueError: print(number, 'Is not a prime number') if flag: print(number, 'Is not a prime number') else: print(number, 'Is a prime number')