create a python function that gets the average of two numbers plus three in python

Here's an example of a Python function that calculates the average of two numbers, adds 3 to the result, and returns the final value:

main.py
def avg_plus_three(num1, num2):
    avg = (num1 + num2) / 2
    result = avg + 3
    return result
99 chars
5 lines

To use this function, simply pass in two numbers as arguments:

main.py
print(avg_plus_three(4, 8))
28 chars
2 lines

This will output 7.0, which is the average of 4 and 8 (which is 6) plus 3.

gistlibby LogSnag