1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

feat: rewrite programming-challenges CLI (#3)

This commit is contained in:
Divlo
2021-06-09 20:31:45 +02:00
committed by GitHub
parent 7aa12f313e
commit 677a55a9d8
256 changed files with 16829 additions and 1881 deletions

View File

@ -10,4 +10,4 @@ The function should return `true` if a given number is a prime number and `false
## Examples
See the `input-output.json` file for examples of input/output.
See the `test` folder for examples of input/output.

View File

@ -1,18 +0,0 @@
[
{
"input": [4],
"output": false
},
{
"input": [19],
"output": true
},
{
"input": [97],
"output": true
},
{
"input": [54],
"output": false
}
]

View File

@ -1,5 +0,0 @@
# python-prime - is-prime-number
Programming language : Python
Created by [@Divlo](https://github.com/Divlo) on 5 July 2020.

View File

@ -1,10 +0,0 @@
# Only the non-zero and positive divisors
def divider_list(number):
number_list = []
for index in range(1, number + 1):
if number % index == 0:
number_list.append(index)
return number_list
def solution(number):
return len(divider_list(number)) == 2

View File

@ -0,0 +1,3 @@
# is-prime-number/python/function
Created by [@Divlo](https://github.com/Divlo) on 6 June 2021.

View File

@ -0,0 +1,25 @@
from typing import List
import sys
input_values: List[str] = []
for value in sys.stdin:
input_values.append(value.rstrip('\n'))
def divider_list(number: int) -> List[int]:
number_list: List[int] = []
for index in range(1, number + 1):
if number % index == 0:
number_list.append(index)
return number_list
def solution(number: int) -> bool:
return len(divider_list(number)) == 2
is_prime_number = solution(int(input_values[0]))
if is_prime_number:
print('true')
else:
print('false')

View File

@ -0,0 +1 @@
4

View File

@ -0,0 +1 @@
false

View File

@ -0,0 +1 @@
19

View File

@ -0,0 +1 @@
true

View File

@ -0,0 +1 @@
97

View File

@ -0,0 +1 @@
true

View File

@ -0,0 +1 @@
54

View File

@ -0,0 +1 @@
false