From b6cca1137d2407555de6160363b09bdc9d16260e Mon Sep 17 00:00:00 2001 From: ENG19CS0222 <76087442+ENG19CS0222@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:03:27 +0530 Subject: [PATCH 1/2] ENG19CS0222_PYTHON_SEE --- debug_exam.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debug_exam.py b/debug_exam.py index aec16fa..797784f 100644 --- a/debug_exam.py +++ b/debug_exam.py @@ -26,7 +26,7 @@ be added to the (initially empty) dictionary to be returned. -In this implementation, data1 is a +In this implementation, data1 is A dictionary and data2 is a list where each key-value pair in data2 is also a list [key, value] of length 2. @@ -51,8 +51,7 @@ def uniqueUpdate(data1, data2): # Remove (k, v1) from data1 del data1[k] else: - # Add (k, v2) to data1 - data1[k] = v2 + # After processing all (k, v2) in # data2, return the dictionary return dupKeys From 87fba93d00587fd5a29aab48f26276b8229050ad Mon Sep 17 00:00:00 2001 From: ENG19CS0222 <76087442+ENG19CS0222@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:12:11 +0530 Subject: [PATCH 2/2] ENG19CS0222_PYTHON_SEE --- debug_exam.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debug_exam.py b/debug_exam.py index 797784f..b4f42fb 100644 --- a/debug_exam.py +++ b/debug_exam.py @@ -50,7 +50,12 @@ def uniqueUpdate(data1, data2): dupKeys[k] = [v1, v2] # Remove (k, v1) from data1 del data1[k] - else: + else: + # Add (k, v2) to data1 + data1[k] = v2 + # After processing all (k, v2) in + # data2, return the dictionary + return dupKeys # After processing all (k, v2) in # data2, return the dictionary