From 95f94991a3c7bbe3c9afc1a3ebcee7b26ad0e35c Mon Sep 17 00:00:00 2001 From: Daniel Moix <dwm69@drexel.edu> Date: Tue, 27 Jun 2023 15:55:21 -0400 Subject: [PATCH] Uploading CS 171 Lect 01 --- cs171/Lect01/age_demo.py | 10 ++++++++++ cs171/Lect01/change.py | 7 +++++++ cs171/Lect01/concat.py | 5 +++++ cs171/Lect01/hellocs171.py | 6 ++++++ cs171/Lect01/inputexample.py | 10 ++++++++++ cs171/Lect01/mathdemo.py | 11 +++++++++++ cs171/Lect01/printmultiple.py | 1 + cs171/hello.py | 1 - cs172/hello.py | 1 - 9 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 cs171/Lect01/age_demo.py create mode 100644 cs171/Lect01/change.py create mode 100644 cs171/Lect01/concat.py create mode 100644 cs171/Lect01/hellocs171.py create mode 100644 cs171/Lect01/inputexample.py create mode 100644 cs171/Lect01/mathdemo.py create mode 100644 cs171/Lect01/printmultiple.py diff --git a/cs171/Lect01/age_demo.py b/cs171/Lect01/age_demo.py new file mode 100644 index 0000000..dfa4fc8 --- /dev/null +++ b/cs171/Lect01/age_demo.py @@ -0,0 +1,10 @@ +year = 2023 +course = 'CS 171' +nextCourse = "CS 172" + +print("How old are you?") + +age = int(input()) #This is a text value converted to a number + +print("Your age is", age) +print("Next year you will be", age+1) \ No newline at end of file diff --git a/cs171/Lect01/change.py b/cs171/Lect01/change.py new file mode 100644 index 0000000..aa34560 --- /dev/null +++ b/cs171/Lect01/change.py @@ -0,0 +1,7 @@ +money = int(input("Enter pennies in the piggy bank: ")) + +dollars = money // 100 +remainder = money % 100 +quarters = remainder // 25 + +print("That's", dollars, "dollars and", quarters, "quarters") \ No newline at end of file diff --git a/cs171/Lect01/concat.py b/cs171/Lect01/concat.py new file mode 100644 index 0000000..2fb36f0 --- /dev/null +++ b/cs171/Lect01/concat.py @@ -0,0 +1,5 @@ +text = "hello" +number = 99 +moreText = " world" + +print(text + moreText) \ No newline at end of file diff --git a/cs171/Lect01/hellocs171.py b/cs171/Lect01/hellocs171.py new file mode 100644 index 0000000..321fb34 --- /dev/null +++ b/cs171/Lect01/hellocs171.py @@ -0,0 +1,6 @@ + + + +print("This happens first", end = '...') +print("This happens second") +print("This happens last") \ No newline at end of file diff --git a/cs171/Lect01/inputexample.py b/cs171/Lect01/inputexample.py new file mode 100644 index 0000000..f3bd009 --- /dev/null +++ b/cs171/Lect01/inputexample.py @@ -0,0 +1,10 @@ + +#Example 1 +age = int(input("How old are you?")) + +#Example 2 +print("How old are you?") +age = int(input()) + +if age < 18: # Error + votingAge = True \ No newline at end of file diff --git a/cs171/Lect01/mathdemo.py b/cs171/Lect01/mathdemo.py new file mode 100644 index 0000000..75c6099 --- /dev/null +++ b/cs171/Lect01/mathdemo.py @@ -0,0 +1,11 @@ +left = 22 +right = 7 + +print(left + right) +print(left - right) +print(left * right) +print(left / right) +print(left // right) +print(left % right) + +print(13 % 867) diff --git a/cs171/Lect01/printmultiple.py b/cs171/Lect01/printmultiple.py new file mode 100644 index 0000000..66a957b --- /dev/null +++ b/cs171/Lect01/printmultiple.py @@ -0,0 +1 @@ +print("This happens first", "This happens second", "This happens last") \ No newline at end of file diff --git a/cs171/hello.py b/cs171/hello.py index 498b4e9..061448a 100644 --- a/cs171/hello.py +++ b/cs171/hello.py @@ -1,2 +1 @@ print("Hello CS 171") - diff --git a/cs172/hello.py b/cs172/hello.py index cffd4b6..00201fc 100644 --- a/cs172/hello.py +++ b/cs172/hello.py @@ -1,2 +1 @@ print("Hello CS 172") - -- GitLab