Skip to content

Commit

Permalink
Merge pull request #2371 from Solan-2005/patch-1
Browse files Browse the repository at this point in the history
Create index.py
  • Loading branch information
geekcomputers authored Oct 5, 2024
2 parents a1cd885 + 9acbda4 commit a6a16ff
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
num = 11
#Negative numbers, 0 and 1 are not primes
if num > 1:

# Iterate from 2 to n // 2
for i in range(2, (num//2)+1):

# If num is divisible by any number between
#2 and n / 2, it is not prime
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")

0 comments on commit a6a16ff

Please sign in to comment.