In: Computer Science
Create a Python file num_utils.py that includes:
Create a Python file test_num_utils.py that:
Given below is the code for the question. Ensure to indent as shown in image. Please do rate the answer if it helped. Thank you.
num_utils.py
----
def sum_of_nums(*nums):
s = 0
for n in nums:
s = s + n
return s
def product_of_nums(*nums):
prod = 1
for n in nums:
prod = prod * n
return prod
def average_of_nums(*nums):
n = len(nums)
return sum_of_nums(*nums) / n
--------------
test_num_utils.py
--------------
import num_utils as nu
def test_num_utils():
print('Testing with 1 argument 5')
print('sum = ', nu.sum_of_nums(5))
print('product = ', nu.product_of_nums(5))
print('average = ', nu.average_of_nums(5))
print('Testing with 3 argument 2, 4, 6')
print('sum = ', nu.sum_of_nums(2, 4, 6))
print('product = ', nu.product_of_nums(2, 4, 6))
print('average = ', nu.average_of_nums(2, 4, 6))
test_num_utils()
output