This is one way.
def calculate_average():
n1 = int(input('Enter First Number'))
n2 = int(input('Enter Second Number'))
n3 = int(input('Enter Third Number'))
return int(n1 + n2 + n3)/3
average = calculate_average()
print('')
print('The Average Is:')
print(average)
solved Converting python code into a function [closed]