num=int(input("Please enter any number: ")) lim=int(num/2)+1 for i in range(2,lim): rem=num%i if rem==0: print(num,"is not a prime number") break else: print(num,"is a prime number") Output 1: Please enter any number: 5 5 is a prime number Output 2: Please enter any number: 57 57 is not a prime number
इन्हें भी देखें।
- while loop
- for loop
- nested loops
- loop control statements (Break, Continue, Pass)
- if statement
- if-else statement
- if-elif statement
- nested if statement
- range() function
- keywords
- Identifiers (names)
- Literals
- Operators
- punctuatorts
Python Programs के लिये यहाँ click करें।