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

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]))