Finished and ran reorganize.sh

This commit is contained in:
2026-02-09 12:00:06 -05:00
parent 87eda7839b
commit 45babd2d07
147 changed files with 1468 additions and 0 deletions

BIN
Lab 1 - Group Work/lab1_files/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,67 @@
#############################################################################
from typing import Callable
def testHarness(fcn: Callable, arg: str, expected: str | list) -> int:
''' function to help test an arbitrary function having one argument
Parameters:
fcn: the actual function being tested (pass without calling)
arg: the argument being passed to the tested function
expected: the expected result, either str or list in the context here
Returns:
None -- just prints
'''
result = fcn(arg) # call the student's function, passing the given argument
# see https://unicode-table.com/en/sets/check/
# replace these as you see fit
mark = "" if result == expected else ""
print(f"Testing {fcn.__name__}({repr(arg)}):")
print(f"\t {mark} result = {result}")
print(f"\t expected = {expected}")
if result == expected:
return 1 # correct +1
return 0 # incorrect +0
###################
def main_grading():
count = 0
tests = 0
arg = []; expected = 0; tests += 1
count += testHarness(compute_sum, arg, expected)
arg = [0]; expected = 0; tests += 1
count += testHarness(compute_sum, arg, expected)
arg = [1,2,3]; expected = 6; tests += 1
count += testHarness(compute_sum, arg, expected)
arg = [-1,2,-3]; expected = -2; tests += 1
count += testHarness(compute_sum, arg, expected)
arg = []; expected = None; tests += 1
count += testHarness(compute_product, arg, expected)
arg = [0]; expected = 0; tests += 1
count += testHarness(compute_product, arg, expected)
arg = [1,2,3]; expected = 6; tests += 1
count += testHarness(compute_product, arg, expected)
arg = [-1,2,-3]; expected = 6; tests += 1
count += testHarness(compute_product, arg, expected)
arg = [-1,-2,-3]; expected = -6; tests += 1
count += testHarness(compute_product, arg, expected)
arg = [-1,-2,-3,0]; expected = 0; tests += 1
count += testHarness(compute_product, arg, expected)
print('-' * 30)
print(f"Total tests passed: {count} / {tests}")
print('-' * 30)
if __name__ == "__main__":
main_grading()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,27 @@
zali Zain Ali
eamini Edward Amini
lbaron Liam Baron
lchikh Leith Rouhou
mcory Max Cory
mdonaghy Megan Donaghy
oenkhorgil Yuka Enkh-Orgil
rgleason Ryan Gleason
lhrinda Luke Hrinda
shughes2 Sarah Hughes
jjiang Jerry Jiang
ckenny Chris Kenny
tleamon Ted Leamon
mlogan Miles Logan
smaquera Sara Maquera
fmiele Fran Miele
mnijjer Mehar Nijjer
lpaynter Lucy Paynter
oputnambagley Lando Putnam-Bagley
areed2 Andrew Reed
srice Sam Rice
jroelofs Julia Roelofs
tshapiro Teddy Shapiro
mshimizu Micah Shimizu
jtapiamarte Juan Carlos Tapia Marte
myoung2 Malina Young
nzuze Noku Zuze

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2,3]))
print(compute_sum([-1,-2,-3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2,3]))
print(compute_product([-1,-2,-3]))
def main():
value = compute_sum([0])
print(value)
value = compute_sum([1,2,3])
print(value)
value = compute_sum([-1,-2,-3])
print(value)
main()

View File

@@ -0,0 +1,43 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0]))
print(compute_sum([1,2]))
print(compute_sum([3,4,5,6,7]))
print(compute_sum([-3,4,5,6,7]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0]))
print(compute_product([1,2]))
print(compute_product([3,4,5,6,7]))
print(compute_product([-3,4,5,6,7]))

View File

@@ -0,0 +1,56 @@
def compute_sum(list_: list[int]) -> int:
''' function to compute the sum of a list of integers
Parameters:
list_: a list of integers
Returns:
the integer sum of the list of integers
'''
sum_ = 0
for i in list_:
sum_ += i
return sum_
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
def compute_product(list_: list[int]) -> int | None:
''' function to compute the product of a list of integers
Parameters:
list_: a list of integers
Returns:
the product sum of the list of integers; if the list is
empty, we return None
'''
if len(list_) == 0: return None
product = 1
for i in list_:
product *= i
return product
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
def main():
print(compute_sum([0,0,0]))
print(compute_sum([1,2,3,4,5]))
print(compute_sum([-1,-2,-3,-4,-5]))
print(compute_sum([1,1,1,1,1,1,1]))
print(compute_sum([1,2,3,4,5,4,3]))
print(compute_product([0,0,0]))
print(compute_product([1,2,3,4,5]))
print(compute_product([-1,-2,-3,-4,-5]))
print(compute_product([1,1,1,1,1,1,1]))
print(compute_product([1,2,3,4,5,4,3]))
main()

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More