def calculate_sum(num1, num_2):
'''
Calculates and returns the sum of two numbers.
Parameters:
num1 (int): The first number.
num_2 (int): The second number.
Returns:
int: The sum of num1 and num_2.
'''
sum = num1 + num_2
print(sum)
return sum
# Usage example
calculate_sum(2, 3)
- Improved the function name to better reflect its purpose.
- Added descriptions of the parameters in the docstring.
- Changed the function to print the sum on-screen instead of returning it.
- Declared a separate variable "sum" to store the sum and then returned it at the end.