-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat:Add Fraud data * Add prime Numbers * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry * Add prime Numbers and install poetry --------- Co-authored-by: Sandeep <[email protected]>
- Loading branch information
Showing
9 changed files
with
811 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Pycharm | ||
.idea | ||
*.ipynb* | ||
*.ipynb* | ||
**__pycache__** |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This allows you to import prime_numbers directly from prime_module | ||
from .prime_numbers import prime_numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""This module provides a function to check if the number is prime or not.""" | ||
|
||
def prime_numbers(x: int) -> str: | ||
""" | ||
Determine if a number is prime. | ||
Args: | ||
x (int): The number to check for primality | ||
Returns: | ||
str: A message stating whether the number is prime or not. | ||
""" | ||
for i in range(2,x//2+1): | ||
if x%i == 0: | ||
return f"{x} is Not Prime Number" | ||
return f"{x} is Prime Number" | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
for n in [10,11]: | ||
s = prime_numbers(n) | ||
print(s) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[tool.poetry] | ||
name = "basic-of-python" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Your Name <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
pydocstyle = "^6.3.0" | ||
sphinx = "^8.0.2" | ||
pylint = "^3.2.6" | ||
pytest = "^8.3.2" | ||
pytest-cov = "^5.0.0" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from basic_of_python.prime_numbers import prime_numbers | ||
|
||
def test_prime_number(): | ||
assert prime_numbers(11) == "11 is Prime Number" | ||
|
||
def test_non_prime_number(): | ||
assert prime_numbers(10) == "10 is Not Prime Number" | ||
|
||
def test_smallest_prime(): | ||
assert prime_numbers(2) == "2 is Prime Number" | ||
|
||
def test_one(): | ||
assert prime_numbers(1) == "1 is Prime Number" | ||
|
||
def test_zero(): | ||
assert prime_numbers(0) == "0 is Prime Number" | ||
|
||
def test_negative_number(): | ||
assert prime_numbers(-5) == "-5 is Prime Number" |