aboutsummaryrefslogtreecommitdiff
path: root/challenge-213/robert-dicicco/python
diff options
context:
space:
mode:
author冯昶 <fengchang@novel-supertv.com>2023-04-24 15:20:16 +0800
committer冯昶 <fengchang@novel-supertv.com>2023-04-24 15:20:16 +0800
commit41d1e582715466e4aa27fbb99e1591afa707fa78 (patch)
tree6affcdf0e5c02371adac673aeda0c4d14a81d974 /challenge-213/robert-dicicco/python
parent64b7c608210e55b5564fe44df68d1eacf6d25969 (diff)
parent9df2d961ae00534346eaaceffaf8cfee4ecc88bb (diff)
downloadperlweeklychallenge-club-41d1e582715466e4aa27fbb99e1591afa707fa78.tar.gz
perlweeklychallenge-club-41d1e582715466e4aa27fbb99e1591afa707fa78.tar.bz2
perlweeklychallenge-club-41d1e582715466e4aa27fbb99e1591afa707fa78.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-213/robert-dicicco/python')
-rw-r--r--challenge-213/robert-dicicco/python/ch-1.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/challenge-213/robert-dicicco/python/ch-1.py b/challenge-213/robert-dicicco/python/ch-1.py
new file mode 100644
index 0000000000..75d2a80d93
--- /dev/null
+++ b/challenge-213/robert-dicicco/python/ch-1.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+'''
+-----------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-04-17
+Challenge 213 Fun Sort ( Python )
+-----------------------------------
+'''
+import numpy as np
+
+mylists = [[1,2,3,4,5,6],[1,2],[1]]
+
+for arr in mylists:
+ print("Input: @list = ",arr)
+ evens = np.array([num for num in arr if num % 2 == 0])
+ odds = np.array([num for num in arr if num % 2 == 1])
+ if (evens.size and odds.size):
+ combo = np.concatenate((evens,odds))
+ print(combo)
+ else:
+ print(evens) if evens.size else print(odds)
+'''
+-----------------------------------
+SAMPLE OUTPUT
+ python .\FunSort.py
+Input: @list = [1, 2, 3, 4, 5, 6]
+[2 4 6 1 3 5]
+Input: @list = [1, 2]
+[2 1]
+Input: @list = [1]
+[1]
+-----------------------------------
+'''
+
+