aboutsummaryrefslogtreecommitdiff
path: root/challenge-208/robert-dicicco/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-208/robert-dicicco/python/ch-2.py')
-rw-r--r--challenge-208/robert-dicicco/python/ch-2.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/challenge-208/robert-dicicco/python/ch-2.py b/challenge-208/robert-dicicco/python/ch-2.py
new file mode 100644
index 0000000000..43b2f2b6fc
--- /dev/null
+++ b/challenge-208/robert-dicicco/python/ch-2.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+'''
+----------------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-03-15
+Challenge 208 'Duplicate and Missing' ( Python )
+----------------------------------------------
+'''
+nums = [[1,2,2,4],[1,2,3,4],[1,2,3,3]]
+
+for a in nums:
+ found = 0
+ print("Input: @nums = ",a)
+ ln = len(a)
+ for n in range(ln):
+ if a[n] != n+1:
+ print("Output: (",a[n],',',n+1,")\n")
+ found = 1
+ if found == 0:
+ print("Output: -1\n")
+'''
+----------------------------------------------
+SAMPLE OUTPUT
+python .\DupMissing.py
+Input: @nums = [1, 2, 2, 4]
+Output: ( 2 , 3 )
+
+Input: @nums = [1, 2, 3, 4]
+Output: -1
+
+Input: @nums = [1, 2, 3, 3]
+Output: ( 3 , 4 )
+----------------------------------------------
+'''