Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their product as integers, then as floating-point numbers. Ex: If the input is 10.3 20.4 5.0 Then the output is: 11 1050 11.900000 1050.600000

Answer :

frknkrtrn

Answer:

number1 = float(input("Enter the first number: "))

number2 = float(input("Enter the second number: "))

number3 = float(input("Enter the third number: "))

avg = (number1 + number2 + number3) / 3

product = number1 * number2 * number3

print("Average - Product with integer numbers: " + str(int(avg)) + " " + str(int(product)))

print("Average - Product with float numbers: %.6f %0.6f" % (avg, product))

Explanation:

- Get three numbers from the user

- Calculate the average of the numbers

- Calculate the product of the numbers

- Print average and product of the numbers in required format

Other Questions