diff --git a/cs171/Lect01/age_demo.py b/cs171/Lect01/age_demo.py new file mode 100644 index 0000000000000000000000000000000000000000..dfa4fc8f877e9b763799c8448ac9ed940807e7e9 --- /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 0000000000000000000000000000000000000000..aa34560755bf0ffd1f5dea6cc99630443cb49911 --- /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 0000000000000000000000000000000000000000..2fb36f03d59c86badaafaac30dda6fa11c9b19f4 --- /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 0000000000000000000000000000000000000000..321fb34004c99dc50c6fef39b2d8cd6619f9e8fb --- /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 0000000000000000000000000000000000000000..f3bd00947bfbac581242c77d272e58e7e22c6392 --- /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 0000000000000000000000000000000000000000..75c6099cb48b49ece31514cc748bc7403e6a0958 --- /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 0000000000000000000000000000000000000000..66a957bf6988b45a331bce3087b61599ed767226 --- /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 498b4e9e44a0dcab1687068884597f554c74af32..061448a8d1383c3b10b99d3b4667be38bd953c3a 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 cffd4b61b036cfa62eb2bb11b30ff0f420b27f9e..00201fc1d36c5ba6e591baf4e27144830dbebe1b 100644 --- a/cs172/hello.py +++ b/cs172/hello.py @@ -1,2 +1 @@ print("Hello CS 172") -