Python Program To Find Average Of Two Numbers
Write Python code to find average of two numbers
n1 = input("Enter the Number 1 :--> ") n2 = input("Enter the Number 2 :--> ") # input taken as string in python, # so we have to type cast it avg = (int(n1)+int(n2))/2 print("\nAverage:", "(", n1, "+", n2, ")", "/ 2", "=", avg)
Output:
Enter the Number 1 :--> 10
Enter the Number 2 :--> 6
Average: ( 10 + 6 ) / 2 = 8.0