From 4eae5b6bc446b66c0ef7887503345475f540a4ae Mon Sep 17 00:00:00 2001
From: Daniel Moix <dwm69@drexel.edu>
Date: Tue, 22 Oct 2024 10:55:53 -0400
Subject: [PATCH] Week 5 lecture

---
 cs171/Lect05/minmax.py    | 17 +++++++++++++++++
 cs171/Lect05/nested.py    |  4 ++++
 cs171/Lect05/range.py     |  8 ++++++++
 cs171/Lect05/splitjoin.py | 12 ++++++++++++
 cs171/Lect05/tinker.py    | 12 ++++++++++++
 5 files changed, 53 insertions(+)
 create mode 100644 cs171/Lect05/minmax.py
 create mode 100644 cs171/Lect05/nested.py
 create mode 100644 cs171/Lect05/range.py
 create mode 100644 cs171/Lect05/splitjoin.py
 create mode 100644 cs171/Lect05/tinker.py

diff --git a/cs171/Lect05/minmax.py b/cs171/Lect05/minmax.py
new file mode 100644
index 0000000..5235576
--- /dev/null
+++ b/cs171/Lect05/minmax.py
@@ -0,0 +1,17 @@
+
+
+# Given a list of integer values, write Python code
+# using a for loop and range to sum the values in the list.
+# 
+# Then, confirm that your code results in the same answer
+# as sum()
+
+nums = [8, 6, 7, 5, 3, 0, 9]
+
+myAnswer = nums[0]
+for index in range(0, len(nums)):
+    value = nums[index]
+    if value < myAnswer:
+        myAnswer = value
+
+print(myAnswer == min(nums)) #??
\ No newline at end of file
diff --git a/cs171/Lect05/nested.py b/cs171/Lect05/nested.py
new file mode 100644
index 0000000..e958502
--- /dev/null
+++ b/cs171/Lect05/nested.py
@@ -0,0 +1,4 @@
+
+for i in range(1, 5):
+    for j in range(1, 3):
+        print(i,j)
\ No newline at end of file
diff --git a/cs171/Lect05/range.py b/cs171/Lect05/range.py
new file mode 100644
index 0000000..20a22fb
--- /dev/null
+++ b/cs171/Lect05/range.py
@@ -0,0 +1,8 @@
+
+# for letter in "Hello":
+#     print(letter)
+
+for i in range(1, 10):
+    print(i)
+
+
diff --git a/cs171/Lect05/splitjoin.py b/cs171/Lect05/splitjoin.py
new file mode 100644
index 0000000..c8a9fb4
--- /dev/null
+++ b/cs171/Lect05/splitjoin.py
@@ -0,0 +1,12 @@
+
+
+text = "127.0.0.1"
+parts = text.split(".")
+together = "[DOT]".join(parts)
+print(together)
+
+# vals = [10, 20, [30, 40], [50, 60, 70]]
+# 
+# print(len(vals))
+# for val in vals:
+#     print(val)
\ No newline at end of file
diff --git a/cs171/Lect05/tinker.py b/cs171/Lect05/tinker.py
new file mode 100644
index 0000000..a326282
--- /dev/null
+++ b/cs171/Lect05/tinker.py
@@ -0,0 +1,12 @@
+value = 17
+values = [3, 1, 4, 1, 5, 9]
+word = "Dragon"
+letters = list(word) #str(), int(), float(), list()
+
+myDigits = [0, 0, 1, 1, 0, 0]
+yourDigits = list(myDigits)
+yourDigits[0] = 99
+
+print(word)
+print(letters)
+print(yourDigits)
-- 
GitLab