From d7ae4533c8de97bffbe08fd79e0bcd26069bf977 Mon Sep 17 00:00:00 2001
From: Daniel Moix <dwm69@drexel.edu>
Date: Tue, 19 Nov 2024 10:40:43 -0500
Subject: [PATCH] Week 9 Lect

---
 cs171/lect09/greet.py | 26 ++++++++++++++++++++++++++
 cs171/lect09/scope.py | 22 ++++++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 cs171/lect09/greet.py
 create mode 100644 cs171/lect09/scope.py

diff --git a/cs171/lect09/greet.py b/cs171/lect09/greet.py
new file mode 100644
index 0000000..edcfd83
--- /dev/null
+++ b/cs171/lect09/greet.py
@@ -0,0 +1,26 @@
+def greet(name, timeOfDay=None):
+    if timeOfDay == None:
+        return f"Hey, {name}"
+    else:
+        return f"Good {timeOfDay}, {name}"
+    
+returnValue = greet("Bob")
+print(returnValue)
+
+returnValue = greet(timeOfDay="morning", name="Kim")
+print(returnValue)
+
+# returnValue = greet("Daisy", "afternoon")
+# print(returnValue)
+
+
+
+
+
+
+    
+def positiveNegative(value):
+    return value, value * -1
+# a1, a2 = positiveNegative(5)
+# print(a1)
+# print(a2)
\ No newline at end of file
diff --git a/cs171/lect09/scope.py b/cs171/lect09/scope.py
new file mode 100644
index 0000000..cc65d92
--- /dev/null
+++ b/cs171/lect09/scope.py
@@ -0,0 +1,22 @@
+
+def func(a, b, listC):
+    '''
+    Go away.
+    '''
+    x = 17
+    a = a + x
+    b = b - x
+    c[0] = x
+    c[1] = a
+    c[2] = b
+    print(f"In func(), the value of a is {a}")
+    print(f"In func(), the value of b is {b}")
+    print(f"In func(), the value of c is {listC}")
+
+a = 10
+b = 20
+c = [0, 0, 0]
+func(b, a, c)
+print(f"In main, the value of a is {a}")
+print(f"In main, the value of b is {b}")
+print(f"In main, the value of b is {c}")
-- 
GitLab