diff options
Diffstat (limited to 'challenge-198/robert-dicicco/python/ch-2.py')
| -rw-r--r-- | challenge-198/robert-dicicco/python/ch-2.py | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/challenge-198/robert-dicicco/python/ch-2.py b/challenge-198/robert-dicicco/python/ch-2.py new file mode 100644 index 0000000000..71d5718b18 --- /dev/null +++ b/challenge-198/robert-dicicco/python/ch-2.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python + +''' + +AUTHOR: Robert DiCicco + +DATE : 2023-01-02 + +Challenge 198 Prime Count ( Python ) + +''' + + + +arr = [10,15,1,25] + + + +def isprime(num): + + if num > 1: + + for n in range(2,num): + + if (num % n) == 0: + + return False + + return True + + else: + + return False + + + +for n in arr: + + cnt = 0 + + print(f"Input: $n = {n}") + + for x in range(n): + + if isprime(x): + + #rint(x) + + cnt += 1 + + print(f"Output: {cnt}\n") + + + +''' + +python .\PrimeCount.py + +Input: $n = 10 + +Output: 4 + + + +Input: $n = 15 + +Output: 6 + + + +Input: $n = 1 + +Output: 0 + + + +Input: $n = 25 + +Output: 9 + +''' |
