aboutsummaryrefslogtreecommitdiff
path: root/challenge-098/laurent-rosenfeld/python
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2021-02-14 22:40:30 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2021-02-14 22:40:30 +0000
commitecd2ae6e8506d0fe76034f75c5b82662219d47c1 (patch)
tree2344cb66eeafb9fe4a6e4b19b6f7cd750649008a /challenge-098/laurent-rosenfeld/python
parent26a5aba4829527b494a68ae1ebc4de03d98aaa67 (diff)
downloadperlweeklychallenge-club-ecd2ae6e8506d0fe76034f75c5b82662219d47c1.tar.gz
perlweeklychallenge-club-ecd2ae6e8506d0fe76034f75c5b82662219d47c1.tar.bz2
perlweeklychallenge-club-ecd2ae6e8506d0fe76034f75c5b82662219d47c1.zip
- Added Perl solution to week 98 by Laurent Rosenfeld.
Diffstat (limited to 'challenge-098/laurent-rosenfeld/python')
-rw-r--r--challenge-098/laurent-rosenfeld/python/ch-2.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/challenge-098/laurent-rosenfeld/python/ch-2.py b/challenge-098/laurent-rosenfeld/python/ch-2.py
new file mode 100644
index 0000000000..e1ab38f808
--- /dev/null
+++ b/challenge-098/laurent-rosenfeld/python/ch-2.py
@@ -0,0 +1,9 @@
+def find_insert_pos(target, list):
+ for i in range(len(list)):
+ if list[i] >= target:
+ return i
+ return len(list)
+
+in_list = [1, 3, 5, 7]
+for j in range (8):
+ print('Target: ', j, '->', find_insert_pos(j, in_list))