From c2b7ff4a2b02b0ab966b1118f7e894decceb266f Mon Sep 17 00:00:00 2001
From: Daniel Moix <dwm69@drexel.edu>
Date: Tue, 8 Oct 2024 10:55:55 -0400
Subject: [PATCH] Week 3 Lecture

---
 .DS_Store             | Bin 0 -> 6148 bytes
 cs171/.DS_Store       | Bin 0 -> 6148 bytes
 cs171/Lect03/ch5.py   |  19 +++++++++++++
 cs171/Lect03/hello.py |  64 +++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 .DS_Store
 create mode 100644 cs171/.DS_Store
 create mode 100644 cs171/Lect03/ch5.py

diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..912edaf3d516c18ef0069f900487cfdf3c25d8cd
GIT binary patch
literal 6148
zcmZQzU|@7AO)+F(5MW?n;9!8z45|#6fRTZLft4Ydp_svt!JNS`r8qe!DL+34B+S4B
zRSx1Xg3Umchf0r9qaiRF0;3@?8UmvsFd71bC<H+DHmLsR9z<>$b;@W6jE2DA2mw&}
zpaAMCFfcGUK<Neu4U%GDWPo%57#SE?U@nIA0~kPZAgv%8q!mPiv@$S)SYR_Cy$439
zRz`3)1f&ntB>~Z3?F@`yn?ZcAb_PbU%?u2T5bX?%P@5S+y%><W5bX?%5bX?%VB2A?
z8>L4>U^E0^A;1h_2!QH;R|W>G{eOs(QF1f{Mnhn@h5#drOR$R*sPe?&Lr|TY0F?u=
yK~*s$s7{9H0awMaMgS9JKv4p!98}$dt71k-8v?`!X&-F}zyfHL9u0v32mt`kTN0)K

literal 0
HcmV?d00001

diff --git a/cs171/.DS_Store b/cs171/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..b3898b5425616f75f1171aa795d0f49dcd349002
GIT binary patch
literal 6148
zcmZQzU|@7AO)+F(5MW?n;9!8z3~dZp0Z1N%F(jFwB8(vOz-AaQ7^f5`=OpFl=RoBM
zQ6Rl+3^@#`49N^73`qJx5`;95%8!P?Xb6mkz-S1JhQMeDkQ@TgDwczrWSyfLMnhmU
z1crMEfXW92NZX#l0ZKPOXpj^GBLf4t3&6<0zyb>kMsPoX0VD^~3Zg+;K{QA!10#q9
zHUq4cff1^e5!?*{=>v61Kr~o810&dG5Ff0afe~yo0|O&OI|C!sW=3cag%P5iff1se
zfe~yw%ypymXb6mk04xNUAq)Xf{qM@afUExxQ8h}AhQMeD49gH;WN`_0aROJ$*!>5p
zYeDsC0#wZbs4_-Sy$lfpDFIdO;OdwOGN>p4RR$6VX$R5Z>X?y%0bHApHU?lJG)j+#
I0DVIM0MCXLrvLx|

literal 0
HcmV?d00001

diff --git a/cs171/Lect03/ch5.py b/cs171/Lect03/ch5.py
new file mode 100644
index 0000000..edf0579
--- /dev/null
+++ b/cs171/Lect03/ch5.py
@@ -0,0 +1,19 @@
+
+
+def func1(i):
+    return i + 2
+
+def func2(i):
+    x = func1(i-1)
+    return x + 5
+
+def func3(i):
+    if i <= 0:
+        return 0
+    else:
+        print(i)
+        func3(i // 2)
+
+i = 14
+a = func2(i)
+func3(i)
\ No newline at end of file
diff --git a/cs171/Lect03/hello.py b/cs171/Lect03/hello.py
index 061448a..0a54a46 100644
--- a/cs171/Lect03/hello.py
+++ b/cs171/Lect03/hello.py
@@ -1 +1,63 @@
-print("Hello CS 171")
+# age = int(input("Enter your age: "))
+# if age >= 21 :
+#     print("Line 3 executed.")
+#     print("Line 4 also is conditional")
+#     print("This is because of indentation")
+
+
+def weightToKg(pounds):
+    POUNDS_PER_KG = 0.453592
+    return pounds * POUNDS_PER_KG
+
+def heightToMeters(feet, inches):
+    INCHES_PER_FOOT = 12
+    INCHES_PER_METER = 0.0254
+    totalInches = inches + feet * INCHES_PER_FOOT
+    return totalInches * INCHES_PER_METER
+
+def calculateBMI(pounds, feet, inches):
+    kg = weightToKg(pounds)
+    meters = heightToMeters(feet, inches)
+    bmi = kg / (meters ** 2)
+    return bmi
+
+def weightStatus(bmi):
+    if bmi < 18.5:
+        return "Underweight"
+    elif bmi <= 24.9:
+        return "Normal Weight"
+    elif bmi <= 29.9:
+        return "Over Weight"
+    else:
+        return "Obese"
+        
+
+print("Welcome to BMI Calculator")
+
+validData = True
+weight = float(input("Enter your weight in pounds: "))
+if weight > 0 :
+    heightFeet = int(input("Enter your height (feet): "))
+    heightInches = int(input("Enter your height (inches): "))
+
+    if heightFeet < 0 or heightInches < 0:
+        print("Height entry invalid")
+        validData = False
+
+else:
+    validData = False
+    print("Weight is too low.")
+    print("Calculation cannot be performed.")
+    
+if validData == True:
+    print("Entries were OK. We are clear to calculate.")
+    kg = weightToKg(weight)
+    print("Your weight in kg is", kg)
+    meters = heightToMeters(heightFeet, heightInches)
+    print("Your height in meters is", meters)
+    bmi = calculateBMI(weight, heightFeet, heightInches)
+    print("Your BMI is", bmi)
+    status = weightStatus(bmi)
+    print("In this case, the chart says you are", status)
+else:
+    print("Entry errors. We cannot proceed")
\ No newline at end of file
-- 
GitLab