mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Merge branch 'master' of https://github.com/TheAlgorithms/Python
This commit is contained in:
17
maths/PrimeCheck.py
Normal file
17
maths/PrimeCheck.py
Normal file
@ -0,0 +1,17 @@
|
||||
def primeCheck(number):
|
||||
prime = True
|
||||
for i in range(2, int(number**(0.5)+1), 2):
|
||||
if i != 2:
|
||||
i = i - 1
|
||||
if number % i == 0:
|
||||
prime = False
|
||||
break
|
||||
return prime
|
||||
|
||||
def main():
|
||||
print(primeCheck(37))
|
||||
print(primeCheck(100))
|
||||
print(primeCheck(77))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Reference in New Issue
Block a user