Prime Number | Function in python | prime or not | python programming | education #shorts #python

preview_player
Показать описание
Write a program to create function of

prime number

code:
def operation(x):
if x 1:
for i in range(2,x):
if (x%i)==0:
print(x,"is not prime number")
break
else:
print(x,"is a prime number")
else:
print(x,"is not prime number")
operation(13)

output:
13 is a prime number
Рекомендации по теме
Комментарии
Автор

you can use range 2, int(sqrt(x))+1 :)

xingyanglan
Автор

Instead of going all the way up to x,
It is more efficient to go up just to the square root of x

tahaabujrad
Автор

which application you use to make python programming pls

RK-rugd
Автор

Bhai close kar de chenal ko kyo student ka bhavishya kharab kar raha hai 20 bar else Laga le 😅😅

MohdSaifkhan-wv