Here's a program to check whether a number is prime or not.

Note: Python is an interpreted bytecode-complied language. Our list of Python Coding Interview Questions will clear the basic as well as complex concepts of this high-level programming language.

Example

                                        

num = 11
if num > 1:     
   for i in range(2, num//2):

   if (num % i) == 0:
           print(num, "is not a prime number")
           break
   else:
       print(num, "is a prime number")
else:
   print(num, "is not a prime number")
Output
11 is a prime number

Suggest An Answer

No suggestions Available!