From cd1636260e3d95b5070b5bea99c649b5668b1707 Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 01:37:18 +0000 Subject: [PATCH 1/4] Setting up GitHub Classroom Feedback From cbe368b55804c8b04a549a43250c641944a1559f Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 01:37:21 +0000 Subject: [PATCH 2/4] add deadline --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ce9d6ee..41797a7 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ +[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/wXQiiW8O) # Lab3 \ No newline at end of file From 787f3e3848bb4c65661407f7019366328511ec3b Mon Sep 17 00:00:00 2001 From: dlepo Date: Thu, 23 Apr 2026 19:03:38 -0700 Subject: [PATCH 3/4] lab 3 DONE!!! --- functions.py | 2 +- tasks.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ testcases.py | 5 +++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tasks.py diff --git a/functions.py b/functions.py index a15fca4..06363f1 100644 --- a/functions.py +++ b/functions.py @@ -2,5 +2,5 @@ # Input: a number to be doubled # Result: a number def double(n:int) -> int: - result = n * n + result = 2 * n return result diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..47a353f --- /dev/null +++ b/tasks.py @@ -0,0 +1,59 @@ +# task 1 +more = [x + 1 for x in [1,2,3,4]] # x takes on 1, then 2, then 3, then 4 +print() # more = [2,3,4,5] + +def square(n:int) -> int: + return n * n # n:1 ->1, n:2 ->4, n:3 -> 9, n:4 -> 16 + + +squares = [square(x) for x in [1,2,3,4]] # square = [1,4,9,16], these are all the values that n +print() # becomes after the function call + +def check(n:int) -> bool: + return n > 2 # n:0 ->false, n:1 ->false, n:2 ->false,n:3 ->true + # n:4 -> true + + +answer = [x for x in range(5) if check(x)] # answers = [false, false, false, true, true] +print() + +def inc(m:int) -> int: + return m + 1 # m:0->1, m:1->2, m:2->3, m:3->4, m:4->5 + # + + +def check(n:int) -> bool: + return n > 2 # n:1 ->false, n:2 ->false, n:3 ->true ,n:4 ->true + # n:5 -> true + + +answer = [inc(x) for x in range(5) if check(x)] # answer = [false,false, true, true,true] +print() + +# task 2 +def tally(nums:list[int]) -> int: + total = 0 + for num in nums: + total = total + num # num: 4 total: 4, num: 9 total 13, num: 2 total: 15, + return total # num: 1 total: 16 + +result = tally([4, 9, 2, 1]) + +def copy(nums:list[int]) -> list[int]: + new_list = [] + for idx in range(len(nums)): + new_list.append(nums[idx]) # idx: 0 new_list: [4], idx: 1 new_list: [4,9], idx: 2 new_list: [4,9,2] + return new_list # idx: 4 new_list: [4,9,2,1]. + # this differs from the above loop because it is using indexes to access + # the values in nums, as opposed to accessing them directly. + + +result = copy([4, 9, 2, 1]) + +def increment_all(nums:list[int]) -> list[int]: + new_list = [] + for value in nums: + new_list.append(value + 1) # new_list: [5], new_list: [5,10], + return new_list #new_list: [5, 10, 3], new_list: [5,10,3,2] + +result = increment_all([4, 9, 2, 1]) \ No newline at end of file diff --git a/testcases.py b/testcases.py index 3ebd851..ec18033 100644 --- a/testcases.py +++ b/testcases.py @@ -15,3 +15,8 @@ def test_double_two(self): if __name__ == '__main__': unittest.main() + +# no, that would not have meant that the code was correct. The test cases did not test enough +# values to assess the functionality of the code. You only need to test one number, but the number +# must have the property n*n != 2n. so you just need to test another number that is not 2. +# it was not a syntax error, but a logical error made by the coder. \ No newline at end of file From 6cbf2e72e13d03c47a4d606a524ad377cdb19e43 Mon Sep 17 00:00:00 2001 From: dlepo Date: Thu, 23 Apr 2026 19:03:45 -0700 Subject: [PATCH 4/4] lab 3 DONE!!! --- .idea/.gitignore | 10 ++++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/lab-3-dblepore.iml | 10 ++++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 6 files changed, 46 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/lab-3-dblepore.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/lab-3-dblepore.iml b/.idea/lab-3-dblepore.iml new file mode 100644 index 0000000..e32e054 --- /dev/null +++ b/.idea/lab-3-dblepore.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..3ade852 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9a90ef5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file