From b74bf059fba900a17d31826091ca0505d55c4902 Mon Sep 17 00:00:00 2001
From: Daniel Moix <dwm69@drexel.edu>
Date: Mon, 25 Nov 2024 14:23:55 -0500
Subject: [PATCH] Lecture 04

---
 .DS_Store                   | Bin 6148 -> 6148 bytes
 cs150/lect05/hello.py       |  10 ++++++++++
 cs171/.DS_Store             | Bin 6148 -> 6148 bytes
 cs171/Lect05/hello.py       |  27 ++++++++++++++++++++++++++-
 cs171/lect07/coolatz.py     |  30 ++++++++++++++++++++++++++++++
 cs171/lect07/sumOfDigits.py |  17 +++++++++++++++++
 6 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 cs150/lect05/hello.py
 create mode 100644 cs171/lect07/coolatz.py
 create mode 100644 cs171/lect07/sumOfDigits.py

diff --git a/.DS_Store b/.DS_Store
index 912edaf3d516c18ef0069f900487cfdf3c25d8cd..b2022470454d126e6c9a5199ca41c012e51fd8bf 100644
GIT binary patch
delta 225
zcmZoMXfc=|#>B`mu~3YagMop8V`8C*G!p{^ure?(FfuR*FfbV8q#Fh&=jRqoEL>R+
z5@uycW+-MbWH3cYLG*x0B-z}27nh`*{3MXs-Q8#WekC7sWME)GQISGGML`C{a<JJ9
xObiSYb)+|@C$LR65MkNO&B4vV#K^I+@H_Klei21hkmD658;S^T_7K^_3;=-xFA@L%

delta 82
zcmZoMXfc=|#>AjHu~3+iadHo%v>+1$1TZo%FfcMO2rz7(!I;ms`2eE><7RdaehwxE
e)y*3jzcWwf7g6K{DM|pTpKQXTyg5c>1v3D3J`aZg

diff --git a/cs150/lect05/hello.py b/cs150/lect05/hello.py
new file mode 100644
index 0000000..4c2efa9
--- /dev/null
+++ b/cs150/lect05/hello.py
@@ -0,0 +1,10 @@
+print("Hello CS 150")
+
+values = [10, 20, 30]
+text = "Hello CS 150"
+
+# for letter in text:
+#     print(letter)
+
+print(len(text))
+
diff --git a/cs171/.DS_Store b/cs171/.DS_Store
index b3898b5425616f75f1171aa795d0f49dcd349002..6bf5b373bb72831103c16d7cab58e5b0049d5ac2 100644
GIT binary patch
literal 6148
zcmZQzU|@7AO)+F(5MW?n;9!8zEL;p&0Z1N%F(jFwBD^5;z-AaQ7^f5`=OpFl=RoB~
zsnHM^4S~TM0-(Ih#*o91%8<-Z!hn{4ktIx$%8Lt<a`KZH7#MaW735?VmlzmaV`O4x
zVP#|IVCUfGhz-ujFApwBEGaE^N-T;7@j~+RbCO`}#H6sy)be-%5$F88lElos)FP0Q
z;LMcNq{O0_@XWlF{Bo!K(!7*nuwJMH2PX$-ynsY?wTXd=j)IAWQLT<bwWX1Pj)IA?
zS#2#Rhp4i?bx?eEPHtX)7bKh+86h+S$a7F8nCfO=U_kLxS#VKaPJUiGqyR&aGtWsk
z3{K9^Edc9;5XgGXbMswXpy9#cDyhuJl6A}x&3yCR{1k#}3NrB8V}TUz+vy(e;?>m_
z28KEcCI)zdy%Q2TID;J&EyzJ<K_F-?kc0N_Mu`n43NeD#0y$`LsUZ}!XweVx#>gR|
z*@T08<al}1r=uY-8UjRy0H}OWfL4tTP`Uv^gQOT385qD_07eD|7MPKY;C=uDNDibG
zM1!<~XpmM0Mi2{Z23RWtBUCFRxElh}2kMf5Xs~t$Mh38U21W+3b_Q4_!wAvNzzDUO
z5!ypxglK1AglK1AglLC3Z<HPlfzc3vh5$2!768@%t_%#g`u`ABqvU7^jE2Cl3;{+K
zmtYqsaHWjhf1tV+RG%h5r9rhns5)i@)zc7tASGZ~Cdh!I1egPn18D_S`{1gWkpWVZ
Rk2VBgAv8*lh5-FT000{0!z2Iz

delta 75
zcmZoMXfc=|#>CJzu~2NHo+2aT!~pBbBCG<FrCB%`88-`Zh_P&J@L}G}&cV;Y#L%``
gkmEb^WPTA{PDTa>h64-?3=ETPc%(PSh%8|S0I|XmAOHXW

diff --git a/cs171/Lect05/hello.py b/cs171/Lect05/hello.py
index 061448a..6b77572 100644
--- a/cs171/Lect05/hello.py
+++ b/cs171/Lect05/hello.py
@@ -1 +1,26 @@
-print("Hello CS 171")
+def validateInput(prompt, lowBound, highBound):
+    validData = False
+    while not validData:
+        number = input(prompt)
+        if number.isdigit():
+            number = int(number)
+            if number >= lowBound and number <= highBound:
+                validData = True
+            else:
+                print("Input invalid. Please try again")
+        else:
+            print("Input invalid. Please try again")
+    return number
+
+grades = []
+numGrades = validateInput("Enter number of grades: ", 1, 999)
+
+for count in range(1, numGrades+1):
+    grade = validateInput(f"Enter grade {count}: ", 0, 100)
+    grades.append(grade)
+
+low = min(grades)
+high = max(grades)
+average = sum(grades) / numGrades
+
+print(grades)
diff --git a/cs171/lect07/coolatz.py b/cs171/lect07/coolatz.py
new file mode 100644
index 0000000..af621e5
--- /dev/null
+++ b/cs171/lect07/coolatz.py
@@ -0,0 +1,30 @@
+def coolatz(n):
+    print(n, end=' ')
+    if n == 1:
+        print("Done!")
+    elif n % 2 == 0:
+        coolatz(n // 2)
+    else:
+        coolatz(3 * n + 1)
+        
+        
+# Coolatz Conjecture Pseudocode
+
+
+
+# Given an arbitrary positive integer:
+# Print the number.
+# If the number is 1, stop.
+# If the number is even, divide it by two and repeat
+# If the number is odd, triple it, add one, and repeat
+
+
+
+        
+coolatz(7)
+
+
+
+
+
+
diff --git a/cs171/lect07/sumOfDigits.py b/cs171/lect07/sumOfDigits.py
new file mode 100644
index 0000000..06dd185
--- /dev/null
+++ b/cs171/lect07/sumOfDigits.py
@@ -0,0 +1,17 @@
+
+
+def sumOfDigits(n):
+    
+    # Base Case
+    if n < 10 and n >= 0:
+        return n
+    
+    # Recursive Case(s)
+    elif n < 0:
+        return sumOfDigits(n * -1)
+    else:
+        rightMost = n % 10
+        rest = n // 10
+        return rightMost + sumOfDigits(rest)
+    
+print(sumOfDigits(11))
\ No newline at end of file
-- 
GitLab