HW HACK 1
def procedural_abstraction(numbers):
# Calculates the sum of numbers
total = 0
for num in numbers:
total += num
# Calculate the average
if len(numbers) > 0:
average = total / len(numbers)
else:
average = 0
return average
# Example usage of the procedural_abstraction function
numbers_list = [12, 24, 36, 48, 60]
result = procedural_abstraction(numbers_list)
print(f"Average of numbers: {result:.2f}")
Average of numbers: 36.00
HW HACK 2
def sum_two_numbers(first_number, second_number):
total = first_number + second_number
return total
# Example usage of the sum_two_numbers function
num1 = 5
num2 = 7
result = sum_two_numbers(num1, num2)
print(f"Sum of {num1} and {num2} = {result}")
Sum of 5 and 7 = 12